I tried to make organic manure at home by composting cow dung. Now there are black worm like creatures running in the compost.
What Are Black Worms in Mixture of Cow Dung and Soil
I believe you need to reevaluate your composting method, because properly composted manure is going to produce a lot of heat that will prevent bugs from getting into it. This article has some basics of composting manure: https://www.gardeningknowhow.com/composting/manures/cow-manure-compost.htm