Prevention by washing all fruit and vegetables before eating, washing hands before meals, thorough cooking of all meat (especially pork which may harbour the serious tapeworm cysts).
For your pets, proprietary veterinary worming powders or pills are available from chemists.
Children affected should be taken to the doctor, who will prescribe effective medicine that clears the problem in a few days. As a precaution, all members of the family will probably be asked to take the cure.