When looking at connections there's always 2 things you should keep in mind :
- What are the odds of you not making the connection, and
- What's the impact of not making it?
40 minutes at Newark for a Domestic -> International connection is plenty of time, presuming that your inbound flight is on time, and you're within the same terminal.
Flights from Orlando will almost always arrive in the C terminal, and flights to London will (almost?) always leave from terminal C - so you're covered there.
As for on-time - who can say? There are websites that will give you historic information, but history isn't going to control whether your specific flight is on-time or not.
So all up, the odds of you making the connection are good. Not excellent (if your inbound is more than 10-20 minutes late your odds drop significantly), but still good.
So what happens if you miss the flight?
Newark is a very major United hub. They run multiple flights to London from there every day - especially in the evenings when flights depart as frequently as 1-2 hours apart! Depending on the day, there will likely be 2 other direct flights to London after yours - and the airline will happily move you to one of those flights presuming there are seats available.
Yes, it's possible there won't be seats available - but odds are there will be, especially as it's likely someone from one of the later flights actually went "standby" on your original flight.
Yes, it's possible that you'll end up separated from your traveling companions, and in a middle seat.
But you'll almost certainly get on!
So what should you do? Presuming you've already booked, I'd say go with it. Changing flights is not going to be cheap, and the odds of them letting you do it for free due to the short connection are almost zero.
If you haven't booked, then it comes down to cost. If you can get a later flight to Heathrow for the same price, I'd probably do it. It'll get you in an hour or two later, but it'll be worth it for the piece of mind. But if it's going to cost more, then I'd stick with the 40 minute connection - worst case you miss the flight and end up on a later one anyway!
If you were connecting to a location with less frequent services (eg, one-a-day rather than every few hours) then this would be a very different story! In that case, make sure to allow yourself enough time as having to wait an extra 24 hours for the next flight isn't fun...