Dogs may pick up all sorts of worms and parasites from eating abandoned food that has been in contact with stool residue.
Your dog can get inflicted with tapeworms via fleas or by eating raw meat.
Since fleas are common carriers of tapeworm, it's important to keep your dog protected from fleas by wearing a flea collar.