Don't UK banks use IBAN? It contains a two digit checksum that prevents exactly this kind of mistakes.
Note that it is still possible to check an account number without an IBAN: https://github.com/AntoineAugusti/moduluschecking
The issue here was not the account number being wrong, but rather the combination of sort code and account number being wrong - for which there is not necessarily a checksum digit covering the pair.
I have some accounts where the sort code and account are not directly embedded in the IBAN. So for those possibly there is a mapping table one could refer to.
UK banking system is 6 digit sort code and like 8 digit acc.
The accounts are IBAN compatible though & it's derived from the above - but I can send money to a friend UK-UK without any IBAN stuff.