There are several worms in the genus Eunice including Bobbit worms (Eunice aphroditoisaphroditois) Be very carefully as some have spines that can cause paralysis. I would recommend using gloves to handle any lr in the future as there are many dangerous critters in the ocean. It's hard to tell the exact species you have there but its not good if they were eating your coral. They will also live in the substrate. Many are omnivorous and will eat most anything including corals,fish, and inverts.