First, let's get something straight: Birds cannot hear worms. All bird species have near human-levels of hearing, putting the sounds of worms out of reach.
You may have noticed a bird tilting its head as if it was trying to listen for worms. These movements aren't being made to help the bird hear; they're being made to help it look at the ground. Birds have side-mounted eyes like a horse. To see over the widest area, the bird turns its head so one of its eyes faces the ground so it can search for worms and worm castings. Birds of prey search for rodents in a similar fashion, turning their heads sideways to scan the ground from their perches.
While birds may not hear worms burrowing underground, they do have sensitive feet that can pick up vibrations from this activity. Sometimes you may see a bird hop along the ground or tap the ground with its beak: This doesn't help the bird sense worms, but it does make sounds that simulate rain, drawing worms closer to the surface for easy picking.
Posted 1858 day ago