Actually that depends on the solubility of the testing material which you are using against the nematode. If your test compound is/are soluble in distilled water then only you can use it. Most of the compounds are soluble in DMSO that why people use it. for anthelmintic testing.
DMSO is used as solvent to solubilize your testing compound (active). If your testing material is formulated then no need to use DMSO. In this case only distilled water is enough. If your testing material is not formulated then you have to use solvent. There are many types of solvent. You have to check their solubility. you can also use ethanol, methanol, acetone, DMSO etc. Do not forget to you the same concentration of the solvent as control treatment.
As colleges said before, all depend on the solubility of the compounds to test. If your compounds are water soluble, then there i no need of DMSO, otherwise, DMSO is a pretty good solvent to a wide range of compounds, and because of this, is widely used in biological test as solvent. Don´t forget to use the same dissolvent and in the samae proportions in you control