The horsehair worms which affect ghost shrimp are Nectonema sp.; they can also infect various other decapods such as crabs, other shrimp, and possibly crayfish (not sure this has been documented), so if you have any of those in your tank you should be careful. Other inverts are safe.
Horsehair worms must emerge from the host, find a mate, and reproduce sexually. If you destroy or isolate infected shrimp before the worm emerges, you are safe.