Shipping fee based on distance (postcode)
If you want to charge a variable shipping fee based on where the customer lives (relative to you), this can partly be done using postcodes.
It is NOT possible to charge a fee that changes depending on the distance (kilometres) between you and the customer.
However, you can create multiple shipping methods with different prices and make them available depending on the customer's postcode. This way you can charge a higher shipping price for some postcodes and a lower shipping price for others.
The tool used for this is called "Postcode restriction". Search for the tool in the large search field and activate it there. Once you have done that, you can edit your shipping methods (Settings » Shipping methods) and set which postcodes may have access to a given shipping method.