The UK does have an office of national statistics that handle the census data but it's not in a format that is handy in this circumstance.
Also, UK counties are a bit of a problem as they can be different depending on who you ask. Should you use ceremonial (Lieutenancies Act 1997) or historic counties? should you add administrative areas too?
Probably the best way forward here is to make your mind up on which definition of county you are going to use then gather the information from public domain sources (the UK is a real pain when it comes to getting your hands on postcode/geo data that should be public).
A good starting point may be Wikipedia if you do not want to pay for the data, try pages like [en.wikipedia.org...]
The governments of some countries provide this information free like the US or New Zealand. While the UK ordnance survey charge huge fees and have a restrictive license.
The US military National Geospatial-Intelligence Agency ( [earth-info.nga.mil...] ) provide free data for most (all?) countries around the world.
Countries where they have an interest get covered a lot better than other countries. For example there are a lot more records for Afghanistan or Iran than for the UK. But still most countries are covered reasonably well although some are out of date.
For the UK the NGA does list counties for some places but a lot of places have no county information (counties are listed under ADM1) is incomplete.
I think there is a free web based project that builds on this data, but I can't remember what it is called.