As long as your flights enter and leave from London Heathrow, then you may be OK.
Heathrow has a direct airside transit facility, where it is possible to remain airside in order to switch flights. In that case you wouldn't require leave to enter the UK and so wouldn't need to see immigration. Check with Heathrow/your carrier(s) to see if you could use that facility.
If you're planning to use different airports that require you to enter the UK proper (perhaps to get a train/bus to that other airport) then I'd suggest you pay a bit extra to avoid transiting through the UK.
There is a visa called a "Direct Airside Transit Visa" which is required by some nationalities, even to transit airside. As you're flying from Cairo I'm guessing you may be Egyptian? If so, then Egypt
IS one of those nationalities.
However, there are exceptions even to that rule, depending on your own circumstances. Go through the "check if you need a visa" link on this site and if it states you do need the visa, it also lists the exemptions.
https://www.gov.uk/transit-visa/direct- ... ansit-visa