So, Whip is a one-handed martial weapon with reach. Reach is a feature that, among other things, lets you make opportunity attacks with that weapon out to 10 feet instead of just five.
Reach (p. 147). This property also determines your reach for opportunity attacks with a reach weapon.
— PHB Errata
War Caster lets you cast a spell instead of making an opportunity attack.
Both Hexblade and the Eldritch Invocation Improved Pact Weapon have ways of letting you use a one-handed martial weapon as your spellcasting focus.
So, if you have War Caster, and you have a whip that you can use as a spellcasting focus, would that let you use Eldritch Blast on anyone who provokes an opportunity attack within 10 feet?
As far as I can tell, the real question is whether "spell using the weapon as a spellcasting focus" counts for the "with that weapon" requirement of the Reach property, but I haven't been able to find a clear answer on that.