If they are about the size of grains of rice, it is probably tapeworms. The dog got them either from fleas or from eating a rodent. You won't pick up these species of tapeworm form the dog.
If they are thin and long, it is most likely a roundworm. The dog could have picked them up just about anywhere.
Roundworms are zoonotic (animal disease that can be passed to humans). Although the worms will not mature in a human, if a human (usually a young child) accidentally ingests a roundworm egg, the larvae will hatch and try to travel through the body, causing visceral larval migrans (the larvae travel through the gut) or, more frightening, ocular larval migrans (the larvae travel to the eye). This is very rare, and as long as the feces is cleaned up regularly, the eggs do not have the chance to develop to that stage. And of course, wash your hands!
I am a veterinary technician.