Preferably not, as the worms can be secondary hosts to internal parasites such as Roundworms, and maybe carrying some nasty bacteria since there in the cow feces. Of course, you're not going to be able to totally eliminate them from eating the worms, but properly disposing of the cow feces into an area where the ducks won't be able to feast on every insect near would be nonetheless a precautious measure.
If the compost is well maintained, smells earthy, doesn't contain mold, etc, that should be fine.
If you're only feeding them corn, it would be best to switch them to a diet formulated for waterfowl/all poultry like Purina Flock Raiser, All Flock feed, or Mazuri. Waterfowl fed only corn often develop serious health problems over time such as obesity, wet feather, Bumblefoot, reproductive problems, and many more.