Those look like bristle worms they eat detritus and dead flesh off corals and clean rock. Small ones are ok and good for a tank IMO. When they get really big is when I remove them. If you found them in the sand and under the rock chances are you have them in your rock to. It's really up to your preference some people like them some people don't.