The route that may exist
Long and exclusive possession can found a claim to be registered as owner. The seller's years of occupation may count towards it, and their statement of truth is the evidence; your own occupation continues the period.
The length of the period and the procedure depend on whether the land is registered or unregistered, and they are not the same. That is a question for your conveyancer on the facts of this particular strip rather than something to read off a general page.
Where the land is registered, the process involves notifying the registered owner — who gets an opportunity to object, and an objection that is pressed can defeat the claim. It is a route, not a formality.
What to do before you commit
Find out who owns it. A title search on the adjoining land costs very little and tells you whether you are dealing with a neighbour, a developer, a utility or a company that no longer trades.
Ask whether anyone has ever tried to buy it. A strip that could be bought for a modest sum is a much better answer than any insurance.
Ask about indemnity cover, with a realistic expectation: insurers may decline or exclude where there is an active risk of dispute, and whether the registered owner already knows about the use is the question that decides it.
And price it. If the garden you are paying for is partly somebody else's, that is a valuation point as well as a legal one — and it will be your buyer's point when you sell.