Learned Distance Functionals