This is a follow-up to an answer to a question about War Caster & Reach weapons. It is not the accepted answer, but it is the most upvoted one by a large margin so let's stipulate that yes, a War Caster may cast a spell instead of making an attack of opportunity with a reach weapon is true for the sake of this question.
The scenario
Waclaw the War Caster wields a reach weapon (a whip) and is able to cast Single-Target Touch Action spells like Inflict Wounds, as well as Single-Target 5-foot Action spells like Booming Blade.
Fred the Futile Foe is standing 10 feet away from Waclaw, and decides to move away from him, provoking an opportunity attack.
Waclaw decides he's going to cast a Single-Target Action spell instead of whipping Fred, as per the War Caster feat, but wonders whether Inflict Wounds and/or Booming Blade would be valid to use here. In this scenario, Waclaw does not have any additional ability (such as the Distant Spell metamagic option or the Spell Sniper feat) to increase the regular reach of his spells.
Can a War Caster (Waclaw) cast a Touch (Inflict Wounds) or 5-foot range (Booming Blade) spell instead of making an opportunity attack (towards Fred) with a reach weapon (whip)?
Logic would say "probably not" to me, but I don't know what RAW and/or RAI would say.