A 40-year UK mortgage is usually a warning sign you have stretched yourself to buy a house you cannot really afford on a 25-year term.
You will renew the rate roughly every 5 years - eight renewals over the full term, eight chances for rate hikes, redundancy or a market crash to break you.
Buying only beats renting if you stay 5 to 7 years, but the 40-year structure pushes you to need to stay much longer to build any equity.
The narrow case where 40 years makes sense: you could comfortably afford a 25-year payment and deliberately choose 40 to free up cashflow you actually invest.
