Vijayadas ji,
They are earth worms. They come out because of too much watering. They
will perish if the water submerges them. I have experienced this when
ants have entered my wormi-compost tank. One way of saving the worms,
I thought was to inundate the tank. The ants were wiped out but the
earthworms started coming out and trying to escape. we had to put them
in another tank and save them. Later we re introduced them and
everything was fine. The earth worms in your picture are trying to
save their lives.
Regards
Yazdy.