Are you finding the distance between their centers? Or their closest points?
You can center the spheres by completing the squares:
x2 + y2 + (z2-6z +9)-9 = 0 or x2 + y2 + (z-3)2 = 9 which has center (0,0,3) and radius = 3
(x2 -18x + 81) - 81 +(y2 +16y + 64) - 64 + z2 = -144 or (x-9)2 +(y+8)2 +z2 = 1 with center (9,-8,0) and radius = 1
Just use Pythagorean distance formula between centers.
If you want nearest points distance, just subtract the two radii from the distance between centers.