Throw out everything that isn’t in a sealed jar or can. Wash every surface with the hottest water you can stand. Never again store an open container of anything that isn’t inside a sealed container.
If you want to nuke the pests from orbit, put mothballs in the pantry, seal the doors for a week or so, then wash it thoroughly again, let it air out for a few days and hope you don’t get cancer.
I had those probably close to 10 years ago and it’s awful! At first I didn’t equate the tiny little moths with anything but them getting in from outside. Then I started seeing these little worms crawling on my free-standing pantry and I freaked! I took everything out, threw most of it away and bleached the heck out of the shelves, the back, the cracks, etc. To this day, I either put stuff in the fridge or it’s in a sealed container. Thankfully, I’ve never had them again!
We are currently fighting an infestation of these little buggers. Fortunately (?) they are in the garage, not in the house. (Yet.) It appears that they were either already in, or got into, some bird seed we had stored in a plastic tub over the winter. We’ve got traps out, been hunting down the larva, and have spent the week moving shelving units around and cleaning out all the corners and crevices. They are everywhere! I had to throw out my lawn mowing shoes, gardening hats and gloves, a couple of bike helmets… even found some grubs in the treads of our bicycle tires!
My wife says she’d almost rather have them in the pantry… It would be easier to clean everything out all at once.
Yes, they are damned hard to get rid of. You have to eliminate every possible food source for months. So no leaving food out for your pets.
I had a couple of nasty infestations and finally realized the source: store-bought shelled roasted sunflower seeds in plastic jars with screw-on metal lids. So it’s not enough to get rid of stuff that’s not sealed, if the sealed stuff is the source.
Put out a bowl of soapy water with a sweet smelling soap. They will be attracted to the bowl, land on the water and then drown. I have seen only a couple of infestations in my home over about 30 years, and this method has worked every time.