Adult horsehair worms shouldn't be outside of water. At least no species I'm aware of. It looks like a mating ball somehow got stuck on shore. In most species the females are much larger than the males. It looks the males died and dried out but there's a larger female or two still alive in there. Just a guess.