Only if the worms are a sort that can live in humans as well as dogs.
If so, you could catch them by accidentally introducing the worm eggs into your mouth. You can pick up worm eggs from the soil in your garden, the animals fur, it's droppings, or possibly from it licking your face. Hence the wisdom of always washing your hands before you eat. Also worm pets regularly according to the instructions.
This does not just apply to dogs - it would apply to cats, pigs, etc as well.
The eggs from the worms will almost definitely be transferred from the dog's anus to your carpets and furnishings and clothes so WORM YOUR DOG and WASH YOUR HANDS - there are at least 3 types of worm you can catch from your pets, not to mention more invisible types of parasites, so good hygiene for yourself and your pets is very important.