Scaling the distance between objects
There's a button in the header bar (three dots with a left-right arrow under it) that when switched on means that your transformations will only apply to the centre points of the selected objects. Using that tool and pivoting by active element will allow you to scale two objects, keeping one in place, moving the other away or towards the active object and leaving the scale of the actual objects themselves untouched.

Setting the absolute distance between two objects could be done with a "Limit Distance" constraint set to a Clamp Region of "On Surface", which you could then key the distance value for.