If and only if the Spellcaster has Eldritch Blast and Agonizing Blast
Sure.
Meanwhile the Wizard has more spell slots to throw out 1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, and 9th level spells...
The point I was making was that even Warlocks, the Cantrip Caster, can keep pace with fighters all day long on Cantrip-Use and then turn around and do big bold effects at 5th level 4 times per short rest, and 1 large 6th, 7th, 8th, and 9th level spell once per long rest...
And that's not even getting into their Subclass Features to compare to the Champion, Battlemaster, Eldritch Knight, etc. Who use their subclass abilities to close the gap on Spellcasting...
But the Warlock -still- gets Hurl Through Hell and other abilities, plus their invocations for noncombat versatility like extra social skills, free spellcasting, or just nifty new things to do with their cantrips.
Martials need more variety of things they can do, out of combat, and some other new options in combat.
Which is why I love the A5e Fighter with their maneuvers separate from Battlemaster.