When two objects interact with one another, there are a couple of ways to characterize the interaction. One way is to look at the force the objects exert on one another. The second way is to look at the potential energy associated with the interaction.
For two masses m and M, separated by a distance r, the gravitational potential energy associated with their interaction is:
Ug = -GmM/r
The gravitational potential energy is zero when one mass is infinitely far away from the other.
For two masses m and M separated by a distance r, the gravitational potential energy associated with their interaction is:
Ug = -GmM/r
The gravitational potential energy is zero when one mass is infinitely far away from the other.
Similarly, for two charges q and Q seperated by a distance r, the electrostatic potential energy associated with their interaction is:
Ue = kqQ/r
The electrostatic potential energy is zero when one charge is infinitely far away from the other.
What really matters is how the potential energy changes when masses or charges change positions relative to one another.