No, you're meant to make the opportunity attack with the weapon whose reach the enemy is leaving
The rules on opportunity attacks state:
You can make an opportunity attack when a hostile creature that you can see moves out of your reach. To make the opportunity attack, you use your reaction to make one melee attack against the provoking creature. The attack occurs right before the creature leaves your reach.
Most melee weapons have a reach of 5 feet, as described in the rules for melee attacks:
Most creatures have a 5-foot reach and can thus attack targets within 5 feet of them when making a melee attack. Certain creatures (typically those larger than Medium) have melee attacks with a greater reach than 5 feet, as noted in their descriptions.
To see how opportunity attacks work for weapons with a reach of 10 feet, we need to look at the description of the "reach" weapon property:
Reach. This weapon adds 5 feet to your reach when you attack with it, as well as when determining your reach for opportunity attacks with it.
This specification about opportunity attacks - after the comma - was added in the first PHB errata in 2015.
When wielding a weapon with the reach property, enemies don't provoke an opportunity attack from it when the enemy moves from 5 feet away to further away. They only provoke an opportunity attack from it when they move from 10 feet away to further away.
The description of the reach property says it adds 5 feet to your reach "when you attack with it", including opportunity attacks "with it". The fact that it specifies that the extra reach applies to attacks with the weapon with that property makes it clear that you can't use your whip to attack a creature that provokes an opportunity attack based on your longsword's (5-foot) reach.
The Sage Advice Compendium officially answers a similar question:
How does a reach weapon work with opportunity attacks?
An opportunity attack is normally triggered when a creature you can see moves beyond your reach (PH, 195). If you want to make an opportunity attack with a reach weapon, such as a glaive or a halberd, you can do so when a creature leaves the reach you have with that weapon. For example, if you’re wielding a halberd, a creature that is right next to you could move 5 feet away without triggering an opportunity attack. If that creature tries to move an additional 5 feet—beyond your 10-foot reach—the creature then triggers an opportunity attack.
As you can see, the reach of a weapon is what determines when an opportunity attack is triggered for that weapon.
(Technically, you could always make an opportunity attack, regardless of wielded weapons, when a creature that's next to you moves further away - using an unarmed strike. But for most characters, that's not worth it.)
This is further supported by several unofficial tweets by 5e rules designer Jeremy Crawford.
He originally mentioned it in passing in 2014 in response to a question about the Polearm Master feat. The other user seems to have deleted their account, but SageAdvice.eu retains the text of the tweets so I've reproduced them below:
Polearm Master fluff say you can keep your enemies at bay with reach weapons is not really true if attack is when adjacent
On the grid, the target is adjacent if you're using a quarterstaff, but 5 feet away with the other PM weapons.
Why distance discrepency OA provoke base on weapon? You said earlier reach weapon dont increase if not attacking? #Confuse
Trying to get where yur coming from leave Reg OA with halberd when leaving your reach, creature is adjacent or 10 ft away?
Yes, OA (an attack) is based on your reach with the weapon you're using.
(At the time, the only weapon without the reach property that the Polearm Master feat (PHB, p. 168) benefited was the quarterstaff; the 2018 PHB errata added spears to the weapons that benefit from it as well.)
Crawford reiterated this in another series of tweets in 2016; the initial one asked about monsters' opportunity attacks, but the followups apply the same logic to PCs:
If a monster has 2 different reaches, when does it get opportunity attacks? Like the roc’s talons at 5 feet and beak at 10.
If you have more than one reach, a foe provokes an opportunity attack when it leaves any of them.
Isn't this directly against your official SA article from July 2015?
The SA answer is only about making an opportunity attack with the reach weapon, not with another reach you might have.
So the book is incorrect in saying OAs are for when leaving your reach when it should be your weapons' reach?
"Your reach" means whatever reach of yours is relevant at the moment.
Here, Crawford clearly points out what the phrase "your reach" as used in the rules means. Reach isn't an inherent aspect of creatures, but rather of weapon attacks. By default, it's 5 feet; the "reach" property changes it to 10 feet for the specific weapons that have it.