Small white worms in your houseplant's soil are most likely the larvae of the fungus gnat. This gnat thrives in moist, shaded areas and produce a maggot larvae that may harm the root system of your plant. Once you treat the existing problem, there are cultural controls for preventing the return of the gnats. Always inspect a new houseplant for the worms before bringing it into your house, where the infestation may spread to the rest of your indoor plants.
Remove the small worms by scooping out the top 1 inch of potting soil with a hand spade. Dump the discarded soil in a plastic bag, tie it in a knot, and throw it away.
Apply an insecticide specially intended for indoor plants and targeted to fungus gnats to the soil and the plant itself. Follow the package directions for application.
Replace the top inch of the soil with new, sterile potting soil. From then on, allow the soil to become slightly dry between waterings. Do not let the pot sit in standing water. Keep it in a well-ventilated, sunny spot.