Use custom field as a variable

You are using the_ID() instead of get_the_ID(). Which is being echo.

Also why you are using so many variable and pulling all the meta keys. I would like to suggest this code using get_post_meta().

$my_custom_field = get_post_meta(get_the_ID(), 'app_collection-postcode', true);
$my_custom_field2 = get_post_meta(get_the_ID(), 'app_delivery-postcode', true);
$url = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=$my_custom_field&destinations=$my_custom_field2&mode=driving&language=en-EN&sensor=false";
$data = @file_get_contents($url);
$result = json_decode($data, true);
foreach($result['rows'] as $distance) { 
    echo 'Distance from you: ' . $distance['elements'][0]['distance']['text'] . ' (' . $distance['elements'][0]['duration']['text'] . ' in current traffic)';
}