Parasites have to find their hosts and if you're a parasite of gastropods like snails and slugs, that means being attracted to slug slime - i.e. the chemicals found in the mucus secreted by slugs and snails. Phasmarhabditis hermaphrodita is a parasitic nematode that infects and kills its molluscan hosts and has, in fact, been shown to be attracted to their mucus. These parasites are commercially sold as slug pest control agents in the U.K. Other studies have shown that the parasites are somehow able to manipulate the behavior of their hosts to crawl into the soil -this allows the nematodes to complete their development before the dead slug or snail or consumed by a scavenger.
Image is from this site.