According to the IUPAC goldbook, the definition of the mesomeric effect is as follows,
The effect (on reaction rates, ionization equilibria, etc.) attributed to a substituent due to overlap of its p- or π-orbitals with the p- or π-orbitals of the rest of the molecular entity. Delocalization is thereby introduced or extended, and electronic charge may flow to or from the substituent. The effect is symbolized by M. Strictly understood, the mesomeric effect operates in the ground electronic state of the molecule.
This effect is distance independent unlike the inductive effect which is defined as follows,
In strict definition, an experimentally observable effect (on rates of reaction, etc.) of the transmission of charge through a chain of atoms by electrostatic induction.
In your case, the cations we need to compare are p=methoxyphenyl carbocation and o-methoxyphenyl carbocation. Here we need to see two major effects, the mesomeric effect and the inductive effect.
These are the resonance structures of the methoxyphenol substrate, which shows that there is an increased electron density at the o- and p- positions. This means that a carbocation is more stabilized when it comes at these two positions.
Now, how do we compare these two positions? This is where the inductive effect comes in. Due to the higher electronegativity of oxygen, the electron density nearer to the oxygen would be concentrated near the oxygen. However, this effect reduces the farther away you move from the oxygen. This makes the o- position destabilized and hence less stable than the p= position.
Therefore p-methoxyphenyl carbocation is more stable compared to the o-methoxyphenyl carbocation.
Remember that inductive effect is a distance dependent effect whereas mesomeric effect is not.