Sort of. In the real world, you only see this in situations where combat is going to degenerate into melee anyway. The handgun is to open things, and then the combatants would switch off to their blades. Early modern boarding actions come to mind, though marines still expected to use their swords in close quarters as recently as the early 19th century.
This approach is more common in eras when firearms are difficult to reload in combat. Since you wouldn’t be able to reload before your opponent got into melee and started carving you up, why bother? Just pull a sword before you start.
Incidentally; if your character needs to reload, they need to put the sword away, reload, then get it back out. It’s doable (if someone else isn’t trying to stab them) but time consuming.
Incidentally, something you don’t see in 40k, that did occur, was rotating through multiple weapons rather than reloading. Blackbeard is infamous for (among many other things) carrying six loaded pistols into combat, and switching after each shot.
In 40k, a pistol and close combat weapon is a fairly common weapon choice for some factions, including the Imperial Guard. For Gaunt, the weapons are almost more badges of office than actual weapons. Commissars aren’t supposed to kill the enemies of the Imperium, they’re supposed to kill guardsmen that decide they’d rather run than go toe to toe with a Daemon, Carnifex or active Monolith.
One thing to note: Gaunt (and most of the characters in 40k) wield the close combat weapon in their dominant hand, with their pistol in their off hand. So, that’s a sword in his right hand, and a bolt pistol in his left. This is probably because it’s easier to operate a firearm with your off hand than a blade. I’d expect that setup follows over into the real world, but we’re dealing with a combat style that doesn’t have much of a place in the modern world, so I’m not entirely sure.
Also, some Chaos units are blade in left, pistol in right, but I’m just going to chalk that up to “they’re Chaos Marines, and we should all be thankful they’re not trying to kill us with a boombox from hell,” not that they found a way to make it work.