Every internal line in a Feynman diagram carries a propagator, a factor that measures how readily a particle carries energy and momentum from one vertex to another. For a photon carrying momentum 𝑞 it is proportional to 1/𝑞2: large when little momentum is transferred, small when a lot is.
That one factor already contains a familiar law. Translated from momentum into distance, 1/𝑞2 becomes the 1/𝑟 of Coulomb's electric potential, so the simplest diagram, two electrons exchanging a single photon, reproduces the ordinary repulsion between like charges.
For a massive particle the propagator includes its mass, and the resulting force dies away exponentially beyond a range of about ℏ/𝑚𝑐. The W boson, at about 80 GeV, gives the weak force a range of roughly 2.5 ×10−18 metres, less than a hundredth of the width of a proton.