Worms are replaced by Rage Worms on Challenge Level (ChLvl) 1 and above - these are spawned from Spikey Eyepods singly (ChLvl 1) or in pairs (ChLvl 2+). Rage Worms have significantly more health and damage than their lesser brethren, but behave similarly to them.
It is very easy to defeat these with a sword (preferably a Colossus, as it has a much larger range), as the single swing will hit most of the sections, making them take a lot more damage than with a single-hit weapon.
If you aren't melee, you might want to use plasma grenades. They can hit multiple sections of the worm at once.
With a weapon that can't hit multiple sections, you can hit the worm right when it spawns and it will hit 3-4 times. This happens because all of the sections are stacked on each other.