For this you need an api to get the correct data, e.g. Postcode API - De standaard in adresvalidatie.
You can call this api on change of the postal code / house number field.
Hope this helps!
There are several APIs available that will allow you to do this. Looking at your name I'm going to assume that you're Dutch – there are various APIs available. A free one I found just now for instance is https://postcode.tech/.
As for a list of countries, you can either choose to call an API, or use one of the existing lists from the marketplace, such as Country enumeration