Let's say that you are wielding a 10' reach weapon, but are engaged at 5' with an enemy who only has 5' reach. Can you stay engaged but move back 5' without triggering an opportunity attack?
No, the Opportunity Attack is still triggered
The PHB (195) is clear on this:
You can make an opportunity attack when a hostile creature that you can see moves out of your reach.
There are no additional caveats regarding remaining within your own reach and the only requirement is moving out of someone else's reach.