There are over 25 species of worms; only 3 species create worm casts.
The actions of worms in the garden are very important; they improve microbial activity and the structure of the soil improves as the worms move around underground creating natural aeration.
It's best if possible to try and tolerate worm casts, they really are beneficial.
If you keep your grass a little longer it will be fairly easy to brush off dry worm casts and incorporate them back into the grass. It’s more difficult to achieve this on fine short mown lawns. When the casts are squashed the muddy smear they leave behind makes an ideal bed for weed seeds and mosses to become established.
There are no pesticides available to remove earthworms. There are products on the market containing sulphur these can act as a deterrent. Worms are generally found in less acidic soils, you can consider getting a soil test with the aim of reducing the soil PH.
Worm casts can be dealt with by using a wire rake or stiff brush, let the casts dry before breaking them up and dispersing them back across the lawn. This can be tricky to achieve when the weather is damp or wet. During autumn and spring when there is a lot of worm activity try and keep off the lawn to avoid additional smearing and spreading of the casts.