Corals sometimes get annoyed by spaghetti worms grabbing at them, but the worms don't hurt them, the corals just go "noo" and shrink up to escape the perceived threat. If a worm is right in the middle of a bunch of corals and is constantly groping over them, it can annoy them into always being retracted, but otherwise they're absolutely harmless.
Yes, the main part is inside the rock. An entire spaghetti worm looks like a weird fat worm with a bunch of threads coming off one end. They come in weird colors, too, I had some 1.5" ones that were lime green.