I'm writing a science fantasy setting for a tabletop game. Its major influences are Dune, Final Fantasy 7, and Borderlands. My goal is to give a universal account why swords, spears, etc., equal or even best guns between fighters of equal skill. Let me define my terms:
By guns I primarily mean modern ballistic firearms, like what you'd see in a Call of Duty game. I'm not as interested in making lasers, rail guns, grenades, etc, comparable to hand-to-hand weapons. If you can relate them in your answer, though, that would be extra appreciated. The setting is not premodern, so flintlocks and other obsolete guns are out.
By raw-ability I mean explanations like Star Wars where superhuman powers, strength, or magic make exceptions for hand-to-hand combat. My major concern here is, "If the sword wielder has x level skill, why can't the gun wielder with X level skill be even better?" I'm not trying to explain why super heroes can overcome guns with swords. I'm looking to explain why swords themselves are comparable to guns as part of the world's "natural law."
By exceptional explanations I mean something like Dune where special technology, geography, monsters, or other special scenarios make melee weapons desirable. Although brilliant, explanations like Herbert's create more "an exception to the rule" than they account for a universal law of the universe why axes can keep up with machine guns. This rules out making specific environment a primary reason for melee combat. If the world only featured close-quarters environments, for example, that might work, but it features a relatively varied amount of environments and I'm looking for a reason why melee will be desirable in most environments by default.
So, in terms of goal, I'm looking for a vaguely Advent Children-esque world where plebs walk around with firearms for self-defense while mercs dabble in swords, spears, maybe gun-fu, but where the setting neither turns into wuxia supermen battles nor hard sci-fi tech.