Java, 257257 228 bytes
enum Z{MeMercury(0),VVenus(5029),EEarth(9169),MaMars(17003),JJupiter(72042),SSaturn(136669),UUranus(281564),NNeptune(444309),PPluto(584847);long r;Z(long x){r=x*10000;}static long d(String...s){return gZ.valueOf(s[1]).r-g(s[0]).r;}static Z g(String s){for(Z z:Z.valuesvalueOf()s[0])if(s.contains(z.name()))return z;return null;r;}}
static Z g(String s){...}
returns the appropriate enum constant which has the planet's distance from Mercury.
static long d(String...s){...}
solves the challenge. Input requires names of planets to have the first letter capitalized and the rest ofmatch the name in lower caseenum's constants' names exactly. I love how java provides a string to enum conversion method for me <3
Usage:
Z.d("Mercury","Pluto")
returns 5848470000
Z.d("Pluto","Mercury")
returns -5848470000
Z.d("Uranus","Neptune")
returns 1627450000
Z.d("Mars","Pluto")
returns 5678440000