NOTE: This answers the OP’s original question about how to prove the invariance of length under Galilean transformations. The question has been edited and is now a completely different question about Lorentz transformations.
A Galilean transformation is
$$\begin{align} x’&=x-v t\\ y’&=y\\ z’&=z\\ t’&=t \end{align}$$
when the relative motion between the frames is in the $x$-direction. We can always take coordinates in which this is the case.
“Length" in Galilean relativity means "spatial separation at the same instant"... for example between the events $(x_1,y_1,z_1,t)$ and $(x_2,y_2,z_2,t)$. (Note that all Galilean observers agree on what "at the same instant" means, because $t'=t$.) So the components of spatial separation for computing the length are
$$\begin{align} \Delta x’&=x_2'-x_1'=(x_2-vt)-(x_1-vt)=x_2-x_1=\Delta x\\ \Delta y’&=\Delta y\\ \Delta z’&=\Delta z. \end{align}$$
because the $vt$ term drops out when computing differences in $x$ at the same instant.
Thus the length
$$\begin{align} \ell'&=\sqrt{(\Delta x')^2+(\Delta y')^2+(\Delta z')^2}\\ &=\sqrt{(\Delta x)^2+(\Delta y)^2+(\Delta z)^2}\\ &=\ell \end{align}$$
is invariant.
Thanks to Ben Crowell for suggesting how to improve the answer.