The answer by Vincent Thacker is correct, but I hope I can clarify further.
The term "length contraction" or "Lorentz contraction" does not refer to a distance between any given pair of events. Rather it refers to a separation between two worldlines. The worldlines are typically the ones at the two ends of a given solid object. But how do you measure the distance between lines? If they were lines in space then we might for example employ the perpendicular distance, and there is just one answer. But for lines in spacetime there can be more than one suitable way to state the distance.
In particular, a suitable way to state the distance between the ends of a solid object is to pick events on the two worldlines (at the ends of the object) which are simultaneous. The length contraction idea refers to this distance. The specification of which pairs of events are simultaneous depends on the reference frame.
Here is my preferred way to present the calculation.
Consider a rod whose length is $L_0$ in frame S, where it is at rest. The two ends of the rod are therefore at
$$
x_1 = 0, \;\;\;\; x_2 = L_0
$$
and this is where they are for all times $t$, where $t$ is the time coordinate in frame S.
Now let's see where the ends are in frame S$'$. We employ the Lorentz transformation:
$$
t' = \gamma( t - v x / c^2 ), \\
x' = \gamma( x - v t )
$$
so events on the worldline of the first end are at
$$
t_1' = \gamma t, \\ x'_1 = -\gamma v t
$$
and events on the worldline of the second end are at
$$
t_2' = \gamma (t - v L/c^2), \\ x'_2 = \gamma(L- v t).
$$
Now we want to find where the ends of the rod are, as measured in frame S$'$, at some moment in that frame. We pick the moment $t' = 0$. We find that at $t_1' = 0$, the above equations yield $x_1' = 0$. And at $t_2' = 0$ we obtain $t = vL /c^2$, which, when substituted into the equation for $x_2'$, gives
$$
x_2' = \gamma( L - v^2L/c^2) = \gamma L (1-v^2/c^2)
= \frac{\gamma L}{\gamma^2} = \frac {L}{\gamma}.
$$
Hence the length of the rod is $x_2' - x_1' = L/\gamma$. Where, to repeat, by "length" we mean distance between the ends at events found to be simultaneous in the frame under consideration.