Dogs can get hook, round & whip worms from grass ONLY if an infested dog was in that area, they can also get it by their feet from walking on infested grass or dirt.
Tapeworms are ussually transmitted by ingesting infected fleas, infected rodents & other dogs infected feces. It sounds your dog has tapeworms which is the least health threatning worms as long as the dog has adequate food & water. A sipmle oral liquid, pill or shot will get rid of them.