There's a big advantage to being a ranged combatant. We can see this in real-life history. Basically ever culture has, at one point or another, developed the Bow, or at least some means of attacking at range. The development of gunpowder weapons transformed warfare, to the extent that basically any soldier in the modern era basically never wants to be up-close and in melee range with an enemy.
In D&D, this is also very true, especially given that most monsters are incapable of fighting at range - you can do a lot for your own survivability if you can attack your enemy from a distance where they need to take their entire turn just getting to you, if they even can.
As such, it makes sense to me that melee characters should have more power - they take more risk and should thus get a greater reward.
Two feats in the 2014 version of D&D were fairly dominant in terms of damage-dealing potential: Great Weapon Master and Sharpshooter. Both of these feats had a few aspects, but the primary one was similar: you could take a -5 penalty to your attack roll and, if you hit, get a +10 bonus to your damage. Given the massive size of that damage boost, the reduction to your hit chance winds up, in most scenarios, to be a worthwhile trade, except against targets with very high ACs.
And, in a way, the size of this boost also flattens, slightly, the damage deficit from using a ranged weapon - while a Longbow only does 1d8 damage compared to a Maul that does 2d6 (a difference of 2.5 average damage) when you're adding a full 10 to that, the distinction is kind of tiny.
2024's PHB, though, redesigns both of these feats. The new Great Weapon Master grants a smaller damage bonus, but this is automatic whenever you are attacking with your action, with no reduction in hit chance. I've found that, in most scenarios, especially as you get to higher levels, this feat winds up being better than the old one. But the new Sharpshooter no longer actually grants any bonus to damage at all - it still allows you to attack at long range without disadvantage and avoid half and full cover penalties, but rather than this damage boost, it instead allows you to attack with a ranged weapon in melee range without disadvantage.
In a vacuum, this would seem to put ranged characters at a major disadvantage. And I don't know that this is entirely wrong.
Melee characters have a few feats that can boost their damage - the three that I find most notable are Great Weapon Master, Polearm Master, and Dual Wielder. Depending on how high-level you are, and thus how many feats you can afford to pick up, I generally find GWM to be the most powerful of these.
Another thing that really complicates the whole damage narrative is weapon mastery. Graze, found on the Greatsword and Glaive, is a pretty significant damage boost (and, psychologically, has the nice effect of letting the player feel like they've done something on their turn even if they "miss"). This mastery is not found on any ranged weapons (or any light weapons that a dual-wielder might use). For ranged combatants, however, there are a few weapons that have Vex - a mastery that gives you advantage on your next attack against the target if you hit them. This is also, indirectly, a damage boost.
In fact, only three weapon masteries show up on ranged weapons (not counting the modern/futuristic weapons found in the DMG,) and these are Slow, Vex, and Push, the latter of which only shows up on the Heavy Crossbow. (The Shotgun, a modern weapon, also has Push, which is finally a real reason to use it instead of a Revolver).
Of these, if we're talking about damage potential, I think we can only really consider Vex weapons, which are the Dart, the Shortbow, the Blowgun, the Hand Crossbow, and the Pistol (how is the Blowgun a martial weapon?)
Among these, the Pistol has the highest damage die, dealing 1d10 damage (plus Dex) on a hit, which actually puts it on par with some of the most powerful melee weapons (just shy of the max-12 ones). Firearms, however, have the following problem: they have the Loading property, This is also an issue for Crossbows, but the Crossbow Expert feat allows you to ignore this. The Gunner feat, from Tasha's Cauldron of Everything, solves this problem for you, and certainly as a DM, my intention is always to allow old character options (you can take my Undead Warlock patron from me when you pry it from my cold, dead, hands... and then I'm going to take it back from you). But, this does mean a feat investment where someone with a Shortbow would not need one.
But, absent the old Sharpshooter feat, what might we use to gain more damage?
Among the old classics is the returning Crossbow Expert. This feat I believe got some tweaks compared with the old version, but still allows, essentially, Light Crossbow dual-wielding. While Light Crossbows can technically be dual-wielded by anyone, the feat explicitly allows you to hold one in each hand and not worry about loading them. In terms of damage, the feat actually only adds your Dex modifier (or I suppose Int if you're a Battle Smith) if you don't already have something like the Two Weapon Fighting Style. I still think it's probably necessary to deal with the loading issue - but it's also arguably nerfed because you won't get benefits from a magic hand crossbow for all your attacks, unless you have two magic hand crossbows.
The damage here is pretty comparable to a melee dual-wielder, as Hand Crossbows deal 1d6 damage on a hit. The downside, though, is that because Hand Crossbows don't have the Nick property, you won't be able to get two off-hand attacks the way that you can with the Dual-Wielder feat.
There is, however, a weird thing you can also do:
Go Great Weapon Master.
The new version of GWM requires only that a weapon have the "Heavy" property in order to gain its bonus damage. As it so happens, there are a couple of Heavy ranged weapons - the Heavy Crossbow (naturally) and the Longbow.
Now, the downside here is that this feat both requires a 13 in Strength and also grants you a point to Strength - an ability score bonus that you're probably not all that interested in if you're building a ranged martial character.
Still, this will mean giving you a pretty big boost to damage - especially at higher levels.
The Heavy Crossbow of course suffers when you get Extra Attack unless you have the Crossbow Expert feat - I'd go for that at level 4 and worry about GWM at level 8, given that 3 extra damage on a hit is not going to be worth losing your second attack at levels 5, 6, and 7.
But the Longbow can pick this up as soon as you want. Again, the lower damage die will be less of a problem as you pile more static damage bonuses.
Of course, neither of these have Vex.
So...
Which do we think does more damage?
Yes, the dreaded math is now coming for us.
I'd guess that our Vex option with the highest potential is the Hand Crossbow. We'll need a free bonus action in order to take full advantage of the Crossbow Expert feat.
Setting aside Battle Smith Artificers, as well as weapon-using Clerics and Druids (who might be into it if they can pick up True Strike somehow,) our three main ranged-weapon-using classes are the Ranger, Rogue, and Fighter. The Fighter is probably the least precious with their bonus action. Rangers might want it for spells like Hunter's Mark, and the Rogue might want their Cunning Action.
I think I want to look at this at level 5, when each class has had the opportunity to get one feat and the Fighter and Ranger have Extra Attack. For the sake of simplicity, I'm going to mainly look at this for the Fighter, though most of this should apply for the Ranger, especially if fighting a big boss monster that doesn't require a lot of moving Hunter's Mark around.
We'll assume that they're starting with 17 in Dexterity. This will mean that the Hand Crossbow (HCB) build will have +4 to Dexterity thanks to Crossbow Expert at level 4, while the Longbow-using GWM build is still at +3. Each character has two attacks with their action.
Vex, of course, means we can't allow equal hit chances to cancel each other out (and we don't have equal hit chances anyway).
Let's assume that, at level 5, we're generally fighting monsters with an average AC of 15 - a mix of higher-armored toughs and probably still a lot that have like 11 or 12.
And Vex makes this a bit nightmarish, so we'll start with the Longbow.
Our Fighter/Ranger has a +6 to hit at this point, with +3 Dex and a PB of 3. Thus, to hit, we've got to roll a 9 or higher. That means we're hitting 60% of the time.
Our hit damage is 1d8+6, 3 from Dexterity and 3 from our PB. So, hit damage is an average of 10.5.
Our crit bonus damage is 4.5.
So, total damage per attack is 6.3, plus 0.225 for our crit damage, giving us a total average damage per attack of 6.525. Two attacks then give us 13.5, nice and clean, for our damage per turn.
Boy, that was quick and now I have to deal with Vex.
There are a lot of ways we might actually start with advantage, and Vex will carry over to our next turn, so it's kind of a nightmare. But, in a vacuum, if we assume that we're, say, attacking a new target each turn, we'll only apply Vex to our second and third attacks (the third being our Light, off-hand, bonus action attack).
So, we'll need to break it into separate things. First, we look at our first attack:
We have a +7 to hit, and thus hit on an 8 or higher, meaning a 65% chance to hit.
Hit damage is 1d6+4, or 7.5, with a crit bonus of 3.5.
So, for the first attack, we're looking at 4.875 plus .175, giving us an average damage of 5.05.
Now, things get complicated:
In the 65% of scenarios where we hit, our second attack has advantage. However, in the 35% where we missed, we don't.
The miss is easy because the average damage is just 5.05 like the first scenario, which we multiply by the 35% miss chance, giving us 1.7675.
But, with advantage, our hit and crit chances increase. We now have an 87.75% chance to hit.
Actually, I'm going to be lazy. Here's the thing: if our average damage of the un-Vexed first hit is over a third of the GWM damage, we can expect that the damage of the second and third attacks will be higher. Thus, the overall damage per turn should be higher with our Crossbow build.
But, there are some reasons why, at higher levels, we might see things change.
The first is that, eventually, the GWM build will be able to catch up in terms of Dexterity, erasing some of the head start lead that the Crossbow Expert build has. The other is that GWM scales up better over time. The extra damage gained from CBE is just a single flat bit of damage on one attack. A Fighter in particular will get a lot more out of GWM - at level 11, not only will the PB at that point be up to 4, but they'll also get another attack that's part of the action, meaning that you're getting potentially 12 damage, compared with CBE's 4 or 5. Hell, at level 20, you're talking 24 extra damage.
But, in these earlier levels, my general sense is that you could probably go dual-wielding hand crossbows.
Notably, the Rogue is more or less limited to this, as they won't have proficiency in any heavy weapons. I also think that the benefits of Vex are really huge for a Rogue - advantage not only makes it more likely for them to hit (and getting just any hit during your turn is huge because of Sneak Attack) but also because advantage gives you sneak attack. The extra-attack scaling of GWM is also pretty useless to them anyway, given that they don't get Extra Attack.
Rangers might be more inclined toward the GWM build, given that they have lots of uses for their Bonus Action. Still, dual-wielding can be a good option for them, especially if something lives long enough for them to get a full turn of all three HCB attacks against a Hunter's Mark'ed target.