They are pale green and dark green worms. They are not often seen but if they are, they will eat something. They seem to be lead by one leading nematode which calls out things like "hungry," "still hungry," or "thirsty" and leads its followers to foods and drinks. They mostly eat wood and coral and drink pineapple juice.
They consume the Krusty Krab and thus put Mr. Krabs' business into jeopardy, even leading the restaurant to being condemned. SpongeBob tells them to leave so he can get to work, but they ignore this command and then proceed to eat his pants. However, they are then lured out by SpongeBob once he starts playing the tune to "Best Day Ever," using his nose as a flute.
They fall asleep after SpongeBob takes them out of Bikini Bottom and becomes tired from playing the song.
After Gary chose his ball over SpongeBob, the latter decides to move out and live under a bus bench on his own. He sees a nematode and befriends it, but it immediately steals his wallet and crawls off.
Things that they consumed
Giant coral with rocks
The Krusty Krab (they almost did it but they were quarantined)
Nematodes are actually roundworms, and are creatures that can live in any environment. The show depicts their behavior more close to the desert locusts in real life, as they come in swarms and consume any vegetation that comes in their path.
SpongeBob SquarePants is the second Nicktoon to mention nematodes; the first time was Doug in the episode "Doug Bags a Neematoad." During a camping trip, Roger Klotz tells Doug about the creature and encourages him to catch it in a manner similar to a snipe hunt.