There are thousands of species of worms in the world. It would help us identify them if you could post a photograph and tell us in which state you live.
I have a feeling though, that they are something else, since one thing most worms can't do it climb birdbath pedastils.
If my hunch is right, you have a thriving crop of mosquito larva. It is a lot of fun to observe wildlife like this, but most people wouldn't consider this a good thing. The solution is to rinse out the bird bath, and then do this everyday throughout the summer. This will keep the water nice and clean for the birds, and prevent the mosquito larva from developing. You see, mosquito mothers lay their eggs in stagnant water. That is why you should tip over, and keep from accumulation any on your property. They don't lay eggs in flowing water, or where the water is frequently - at least weekly - tipped out and changed.
If you can't bear to dispense with them, the Ahimsa solutions are 1) non-action: just leave the birdbath alone. If it rains, they will have the best chance nature can give them, and they will go on to live full, normal, gluttonous mosquito lives. If it doesn't, the bird bath will dry out, and it will spend the end of the line for the larva. - Nature did it, not you. 2) The really gentle solution: carefully pour the contents of the birdbath out into a bucket, and carefully add a little water. Put this bucket some place far away, like the woods, and leave it until the end of summer. Then, clean out your birdbath, so you don't have to play Wu Wei nanny to any other bunches of mosquito larva!
How can you tell that they are definitely mosquito larva, and not something else.
They will be small, and thin, and if they kind of Snap back and forth in the water, you will be pretty sure.
On the other hand, if your birdbath is a saucer on the ground, your worms may be earth worms coming in for a cool drink. They can't live there - they can't swim, birds will eat them, and they are unsightly - so, pour the contents under some mulch, and put your saucer on log, or pedastil.
Let us know if this helps. And next time thow about asking about flowers or tomatoes, or something else more fun?
Best wishes.
Sincerely,
Matt Di Clemente, Brick, New Jersey