The 'problem' (emulating genre with a creaky old RPG mechanic) isn't insoluble, it's just not soluble by making firearms into instant-death wands, or treating hps as structural integrity units instead of plot armor (or something that can be a fig-leaf for plot armor, like 'luck,' which notoriously runs out).
HP, in my opinion, is not plot armor, it is tracking a character’s ability to continue to defend themself from attack. It’s why HP shouldn’t factor into PCs taking out sleeping baddies. If they’ve stealthed close enough then, sure, they’re dead.
This is why guns raise a problem. There’s no real defense to being shot at (except for cover). Unless you’re Neo in the Matrix and you can switch to bullet time (now that might be a fun D&D setting

)
There are actually two separate “guns in D&D” discussions:
1) Only good guys have guns, i.e. “humans” vs “monsters” which can really benefit from upping the damage dealing produced by the guns. Blasting away zombies or what have you with a BFG is awesome.
2) Bad guys also have guns. This the one that suddenly causes trouble because for a gun to feel right, it’s got to hit hard and players don’t like it when their PCs get hit hard and perhaps die. So I agree with CapnZapp, it needs something beyond just rebranding HP. My proposal: shooting a gun accurately is hard. So I would say that a gun shot only hits if you roll a nat-20 (sharpshooter can lower that to 19 or even 18). (this is in an active combat situation, if you’re sniping and the enemy is exposed then you just kill them, only a mean DM would turn this on the players btw, just like we do in regular D&D

). If the shot hits a PC, then the targeted player rolls 2d10 to figure out where their character got hit: 2=headshot, they’re dead, 20=bullet just grazed them. In between means arm, leg, gut etc. Taking cover, but still partially visible means the shooter has disadvantage. Sneaking up behind a person who thinks they have cover gives the shooter advantage. (There would also need to be wound level tracker to make sure people didn’t just take a bunch of shots with no cost)
Utterly unplaytested of course

and my worry would be that things would get boring because the hits would be rare. But that’s kind of what I think you’d have to do to make guns (in the hands of baddies) feel right.