Photons are the elementary particles of the electromagnetic force - you can describe a static electric field as the exchange of photons between charged objects.
If those photons have mass, the field gets weaker for large distances (compared to Coulomb's law), you get a
Yukawa potential.
You can see a similar effect for the weak force, which has massive particles (W,Z) and a very limited range as result. The residual strong force in a nucleus has the same effect: It can be described as exchange of massive pions, and its range is very short.