A Spellcaster with a Cantrip can do similar damage to a fighter on a round to round basis.They can't, though. To be equal to the martials in combat, the spellcaster has to go through a LOT of slots which don't come back until after a long rest. They can't maintain that pace through 6-8 encounters in a day. Further, if they do that, then they aren't using the slots that they don't have outside of combat, either.
Spellcasters have to pick and choose how effective they are going to be in and out of combat. If the caster wants to conserve slots to be able to cast things like knock and such, then they are going to be using more cantrips in combat and they won't be nearly as effective as the marital PC. Further, a lot of the out of combat spells have downsides to their use that many DMs don't engage, which makes them stronger than they are meant to be.
Adding all the Fireballs on top of it just makes the gap that much wider.
It's only when you add in Optional Systems that Martials become particularly powerful in combat. And even then only through a specific series of weapons and tricks.
4d10+20+12+8 (Assuming a 20 strength, a +3 weapon, and the Duelist Fighting Style) with a longsword. 62 average
4d10+20+12 (Assuming a 20 charisma, a +3 Rod of the Pact Keeper, and Agonizing Blast) with Eldritch Blast. 54 average
Yeah, the Warlock loses out on the 8 points from the fighting style... but instead can bounce fools around the battlefield or off cliffs and into other hazards. But you have to admit that's -really- close damage. Add in 4 5th level spells that can strike big areas for similar damage -per target-, and the Warlock steps up before you even -get- into Subclasses.
That said, you could argue that Battlemaster Fighters are stronger than most Warlock subclasses... but I think the best comparison would be the Hexblade against the Champion, myself... just for that 19-20x2.
Anyway. It's feats that make up the bulk of bringing Martials up in and out of combat.