@jernej__s @PeterLudemann @ashwin @Dav
The Royal Mail's postcode database is available to buy (it's also free to query for limited purposes). A delivery service has no business operating if they don't buy a subscription to have access to the latest version.
If all that you need is the city, the first three or four digits will give you that. New postcodes share a common prefix with nearby ones, so it's quite easy to determine the city / town / village with a year-old copy of the database.
The bigger problem is companies using things like Google Maps for delivery, where they take a year or two to add new streets to their maps. The postcode will give them a rough area (the official database contains a set of OS Map coordinates for polygon that the postcode covers), but that doesn't help if their navigation system thinks there are no roads there.
When we moved in, the postcode was in the database before the house was completed. The road was on OpenStreetMap as under construction within a few weeks of planning permission being granted and had the under-construction markers removed once it was completed. It took Google and a few other commercial map vendors over a year to add it to their map. I got a lot of calls from delivery drivers saying 'I am nearby but your house doesn't exist' or some variation. And a shocking number of them were really, really bad at following directions.