I don't know how long the Tesco contract is over, but just for arguments sake, say it was over three years:
£23 x 36 = £828
Assuming you don't need masses of data, you can get a Tesco 2Gb SIM only contract for £7.50 per month, so:
£7.50 x 36 = £270
Then you would have to buy the phone outright, and you could probably pick up an iPhone 11 for under £500, so let's for arguments sake say you got one off Amazon for £480.
£480 + £270 = £750.
So, theoretically, it would be cheaper to purchase an iPhone outright under those terms.