Have you ever noticed that spice grinders usually come with a bossy warning to "Avoid grinding over steaming pots?" I had always assumed it had something to do with not burning the spices (or yourself), but it's actually for the good of the spices, not your hands. Photo by Leslie Seaton.
When you grind pepper or garlic salt or whatever directly over hot water vapour, that water vapour can get all up inside your spice grinder, shortening the life expectancy of your spice. All that added moisture is no good, and contributes to decay, rot and mildew when it can't get back out.
Beyond grinding, you should avoid sprinkling all spices directly over hot pots, no matter what kind of container they're in. Just pour a little out into ramekin or something and then dispense from there, keeping your flavorful friends nice and dry.
5 Tips for Storing Your Spices [The Kitchn]