Tiny, brown flour beetles, like other pantry pests, will eat almost any type of dry foodstuff- even soup-mix powders, dried fruit, and spices. If you find wormlike larvae or filaments in some newly bought grocery product (one mode of entry into a house), reseal the package and get a refund from the store or put the package in an outdoor garbage can.
If you see the insects in an opened package, get rid of it and check the contents of others. Clear the shelves and brush them; eggs or pupae may be in the corners. Paint the shelves’ edges and corners with a household formulation of malathion or diazinon and let them dry.
Line the shelves with fresh paper or wash treated areas with soap and water to prevent contaminating stored food. At all times store dry foodstuffs, including pet food, in tightly closed jars, cans, or heavy-gauge plastic bags.