You can put whatever they have infested in the freezer for a few days, then pick them out and transfer the contents to a sealed container.
When I lived in the tropics it was quite normal to have these in flour, grains, dried legumes, dried chillies etc.
I knew someone would come back with something like this.
You can pretty much forget about eating the things I listed then, oh and dried pasta too.
Besides, if you don’t think you’re eating that stuff already then you haven’t looked at the USDA or FDA Food Defect Levels. There are allowable levels for fun things like insect parts and rodent droppings.