Depends, what system are you working in?
Under Newton's Law, the simplest case, distance and mass are relevant to gravitation which exerts a force instantaneously at a distance. That is, gravity moves with infinite speed.
Under general relativity the motion of massive body creates a distortion in spacetime that propagates outward from the moving body at the speed of light. It's not quite that easy but that's the general idea.
From there it gets complicated.