Someone whose job is guarding a place. And is wearing the appropriate uniform. Tend to wear armor and wield polearms. Often just background characters to set a scene (literally, by standing in the back), or mooks guarding an entrance that the hero must bypass.
Sometimes also called "watchmen".
Fantasy/Medieval/Renaissance: City guards, palace guards, noble's mansion guards, etc.
For the modern variants, use bodyguard or security guard.
Avoid using the guard tag for fantasy bodyguards, as they tend to dress like knights or normal soldiers (and are functionally such, in the case of a noble's "household" guard), or be out of uniform.