Warlock is as viable as other classes
So, let us start by your assumptions:
it seems like the easiest way to play one is as an Eldritch Blast spammer. I understand the damage output can be quite high.
This is right. While it is not the only way to play it, it is arguably the easiest and, as this answer shows, a very viable choice.
Now, let us go to the problem I see you are having:
However, at mid to high levels don't enemies start having resistance to spells below a certain level, making EB unviable?
No. In 5e, the way monsters get magic resistance is the following:
Magic Resistance. The creature has advantage on saving throws against spells and other magical effects.
Note that Eldritch Blast is not a saving throw inducing spell, it is a Ranged Spell Attack, and is, therefore, not affected by it.
The other way monsters get to resist to effects are:
Resistance or immunity to a type of damage. Eldritch Blast does Force damage, which is the least resisted type of damage.
Legendary Resistance. Some enemies can automatically succeed a saving throw. Again, this does not matter, as EB is not a saving throw inducing spell.
Overall, EB will be as effective in high levels as in low levels, and you will not, in any moment, become useless in combat.
Edge Cases
There are some encounters which will make EB useless. From my head, I can think on 3, all of them quite unlikely.
The Helmed Horror is immune to force damage, and, to the best of my knowledge, there is no way to bypass this immunity. From the 3 monsters, this is possibly the one more likely to be met in a regular adventure - even appearing in the published Princes of the Apocalypse. You should avoid this encounter, if possible.
The Rakshasa is immune to spells of 6th level or lower. This is a CR 13 monster, so it is pretty much a screw all spellcasters, not specific to Warlock, but Warlock will be the one most screwed by it. But then again, it is one specific creature among hundreds of others.
And finally, the Tarrasque. It has the Reflective Carapace feature, which states
Reflective Carapace. Any time the tarrasque is targeted by a magic missile spell, a line spell, or a spell that requires a ranged attack roll, roll a d6. On a 1 to 5, the tarrasque is unaffected. On a 6, the tarrasque is unaffected, and the effect is reflected back at the caster as though it originated from the tarrasque, turning the caster into the target.
So, yeah, Eldritch Blast is useless against a Tarrasque. But hey, so is resisting. Just let it devour you, your friends and the world. Jokes aside, while it is an extremely iconic monster, it is also unlikely your choice of class and build should be made around it, because you are not likely to encounter it any time soon.