I've had these in my shrimp tank too, they are tubifex worms. They'd borrow into the substrate & come out & wave/wiggle when I'd feed the tank. They themselves are harmless but can carry parasites. Initially I thought they were cool because they didn't harm anything but they soon got out of control because they were in my shrimp tank & there was nothing in there that would prey on them & keep their numbers down (no fish in the tank, just shrimp). They became a real eyesore so I stripped the tank & replaced the substrate (sand).
Now I'm just careful when adding new plants to my shrimp tank because I believe that is how they got into my tank in the first place. I've read of people using potassium permanganate to treat plants before adding them into the aquariums but I don't do this. I add new plants to my hospital tank (10g) & let my white cloud mountain minnows pick them clean of any hitch hikers for a couple of weeks before adding them to my tanks. I also dose them with Ick guard, Melafix, & Pimafix which might be over kill or might not do squat actually but it eases me concerns a bit.