Tax accountant here.
Say you owe £10,000 "balancing payment" for 2022-2023 (6th April 2022 - 5th April 2023. You pay the £10,000 by 31 January 2024.
Then you owe "payments on account" for 2023-24 (6th April 2023 - 5th April 2024) which are essentially prepayments of tax. HMRC assume your income will be the same so the two payments, due 31 January 2024 and 31 July 2024 are just your £10,000 balancing payment for 2022-23 split between the two dates. £5,000 each.
So 31 January 2024 you owe the £10,000 balancing payment plus £5,000 first payment on account, 31 July 2024 you owe the remaining £5,000 second payment on account.
31 January 2025 rolls around and you had a better year and owe £30,000 balancing payment for 2023-24. You deduct your two payments on account of £5,000 each meaning you have £20,000 balancing payment for 2023-24 to pay, plus payments on account of £15,000 in January and July (half your balancing payment).
If however, 31 January 2025 came around and you'd had a bad year and only owed £5,000 balancing payment, then after deducting your two £5,000 payments on account you would have a balancing refund of £5,000. Then your payments on account for 2024-25 would be £2,500 each (£5,000 balancing payment divided by 2).
Basically you will keep prepaying next years bill until your final year, where you would then claim to reduce the payment on account as you know your income will be less so you won't owe as much tax. You can claim to do this any year, but if you reduce them by too much and end up owing more you pay interest and they're charging something like 7% at the moment! A good accountant will as part of the service have a chat with you about what you expect profit levels to be like and see if there is scope to reduce the payments on account each year anyway for good cashflow.