andromeda is much farther than LMC but has much more mass. Knowing approximate distances you can maybe calculate the pull on each other and determine if the effect of the mass vs the distance of one or the other is affecting the galaxy more
Presumably this is due to tidal "force" rather than simple gravitational pull. My intuition says that simple gravitational pull would shift the Milky Way's position without altering its structure. Though I can't claim that my intuition is infallible in cases like this.
Tides are the difference in gravitational pull depending where you are in the pulled-on object, and decrease with the cube of the distance between the two objects rather than the square. Since M31 is about 15 times more distant than the LMC, it would need to be 15^3 ~= 3000 times more massive than the LMC to have equal tidal effect. In fact the discrepancy is nowhere near that great.
For what it's worth, current models of galaxy motion suggest that both M31 and the LMC are now closer to the Milky Way than they ever have been before.