That shouldn’t seriously affect any pistol that can pass military trials. You’d probably see some scuffing on the slide and frame, but no real damage. You might knock the sight out of alignment, or manage to wedge the slide partially open, but nothing that would make the weapon unusable.
However, there is one major caveat; guns do not age gracefully with use. This is less true of Glocks, where even conservative estimates put their lifespan at over 100k rounds, but if you’re talking about a 25 year-old M9 knockoff, the gun might literally fall apart (if the impact knocked the takedown lug lose).
Ignoring my low opinion of M9 copies for the moment, heavily used guns are more likely to develop mechanical eccentricities. I still remember handling a .45 USP a few years ago where the slide lock would disengage when loading a magazine. Meaning I had to manually hold the slide open during reloads. I don’t even want to know what would have happened if I’d dropped it.
If you’re talking about an older, poorly maintained, and heavily used gun, then all kinds of unfortunate things can happen. With a gun under 100k rounds, unless there’s some inherent design flaw, getting tossed a few feet shouldn’t do much to it. You may need to cycle the slide if the round in battery is out of position somehow.
The other risk is fouling. Like I said, this shouldn’t happen with a pistol that can pass military trials, but if you get dirt or debris in the barrel it can cause serious problems. An obstructed barrel can stovepipe, (where the bullet becomes caught in the barrel, and the expanding gas ruptures the barrel.) This is something of a worst case scenario, a little dirt or mud shouldn’t foul the pistol to that point. Usually you’ll see this where the barrel is completely clogged. When this happens, the barrel is effectively destroyed, and you’re looking at having to replace that and (probably) the slide, before it can be used again.
It’s also possible to end up with grit or mud in the slide mechanism so the gun can no longer cycle properly. Again, this is unlikely if it’s just getting tossed, but if it’s landing in mud, you’d probably want to take the weapon apart and fully clean it before using it again.
As I recall, the Glock includes a trigger safety that prevents it from firing when the battery isn’t fully sealed. So if the slide is partially jarred open, then the weapon won’t fire. This is something the shooter can feel, when they pull. With a sealed battery, there’s tension against the trigger. If the slide isn’t sealed, the trigger is disengaged from the striker, and it pulls easily. (Someone with more time on Glocks can correct me on this if I’m wrong, and thinking of a different pistol.)