There’s a YouTube video from @StupidIsTheNorm that puts forward what is possibly the best argument for investing in property over stocks.
The main advantage property investments have over stocks is that you can take a loan for property, while you typically have to use your savings to buy stocks.
Imagine you have £20,000 to invest.
Option 1: You use the £20,000 as 10% down payment for a £200k house while a bank loans you the remaining 180k.

If the value of the house goes up 5% over time, that’s an extra £10,000 that’s completely yours. Your debt remains £180k (plus interest & fees)
Option 2: You invest the £20k in Stocks & Shares.
If share prices also go up 5%, that’s an extra £1,000 that’s completely yours, though now you owe nothing.
You could achieve similar dividend or rental yields, so that sort of cancels out. The real difference is the risk vs reward.
With property, the reward is higher but so is the risk. In the unlikely (but totally possible) event that property prices drop by 5% AND you need to sell, your investment has gone down by £10k (50%!)
If share prices go down by 5% and you need to sell, you only lost £1k (5%)

In both cases though, those losses (or gains) only materialize when you sell the stocks or property. So long as you don’t have to sell, the value of the asset is all on paper. The real difference remains the dividend or rental yields.
That’s why I prefer dividend stocks to growth stocks and why I don’t consider a house I live in as an investment.
One more thing to keep in mind is the impact of inflation and interest rates.
While property investments generally rise with inflation, so do interest rates on mortgages. So while the value of your asset appreciates on paper, your net rental yields will suffer.

Stocks on the other hand typically suffer when inflation rises. Luckily there’s no mortgage to worry about.
So if you can hold on tight and only sell at a profit, you’ll be fine.