Worms pass eggs in the faeces which are infective to other dogs.
There are 4 main types of worms that affect dogs; Hookworms, Roundworms, Tapeworms, and Whipworms. Hookworms are quite small, usually about 2cm. Whipworms are narrow and can measure up to 7cm. Adult Tapeworms are usually measure about 15cm however only single segments are usually passed in the faeces. They look like small wriggling grains of rice. This may be what you are seeing.
Tapeworms are of particular concern to you and your family because they can be infective to humans as well. In addition to treating all your animals on a regular basis (adult dogs should be treated every 3 months), you need to ensure you practice good hygiene. You should collect their faeces every day and put them in the garbage to prevent transmission to humans and other dogs. Wash your hands after touching the dog and practice strict hygiene particularly with children. Do not allow them to play in potentially contaminated environments.