Trying to use logic to
answer you question.
1. Wash your vegetables extremely well.
2. At higher temperatures fermentation (and bacteria growth) is much faster. Add sufficient amount of salt as bacteria hate salt. Adding vinegar will inhibit bacteria as well, but I don't like adding acidity. I grew up in Europe and we are not so crazy about acidic foods as people here.
3. Keep your vegetables always submerged, I don't think those worms want to be underwater.
4. Try to use water channel crocks or air lock fermenting jars. Molds, most bacteria and definitely worms need oxygen (air) to survive. By cutting off air you will choke them to death.