How does a dog get worms?

Microscopic worm larvae can be anywhere.  Dogs pick them up by eating contaminated soil, drinking from puddles and, yes, eating an infected dog’s poo.