Mortgages cost interest while you still owe money on them. The quicker you pay it off, the quicker you dont pay any interest. It's just like any other debt. So you can take out a 25 year deal, but if you pay it off in ten years, you only pay ten years interest.
Given we have no clue where you live, only you know if there is a likelihood that prices will go up a lot while you are saving up.
Let's say you borrow £150k for five years. You will pay interest of £65k over five years.
If you dont buy, but instead save up over five years, you will pay £40k in rent over those same five years.
So the mortgage costs you £25k more than rent over those five years.
If the house goes up by £25k in those same five years (which is about 3% a year) then you make your money back, if you own it.
If the house goes up by £25k in those same five years and you don't own it, you have to pay more- £175k now, not £150k.
If there is a risk that you don't manage to save the full £175k in five years, then you have to worry about how much property could go up over the next five years instead.