This is precisely why my snakes are never crawling outside on my lawn. In fact, even humans can get some kinds of worms by walking barefoot outside,
& I have had (& treated) w/c snakes that had worms too. In the case of a large red diamond rattlesnake, he likely got worms by consuming a mammal
(rabbit or squirrel) that had worms, but it's just a guess...he was really lucky to visit my place.