No matter what the rules are I personally wouldn’t travel on a passport expiring in weeks. Although I’m the sort of person who leaves plenty of travel time and goes to the gate when it’s announced!
Another thing to be wary of is some countries only accept a passport is valid for a period of 10 years, where it is possible to have an UK passport for longer (if the passport was renewed months prior to the previous one expiring) this could mean even though you have 4 months left on a passport it does not confirm to border control policies at your destination country and you’ll be denied boarding.