I was doing this math and I found myself dealing with this equation:
$$(5-y)^{2}=(1-y)^{2}$$
Now, square rooting both sides we get,
$$5-y=1-y...(i)$$ or,
$$5-y=-1+y...(ii)$$
Now, (ii) gives us a reasonable root, which is $y=3$. However, (i) gives us a weird result, which is $5=1$. Why do I get this weird result by square rooting both sides?

You weird result is due to performing an invalid step and taking square root the incorrectly: $$\sqrt{(5-y)^2}=|5-y|\not\equiv5-y.$$ (Try $y=7,$ for example.)
Here are two correct solutions:
Method A $$(5-y)^2=(1-y)^2\\|5-y|=|1-y|$$ Continuing graphically:
$$y=3.$$
Method B $$(5-y)^2=(1-y)^2\\25-10y=1-2y\\y=3.$$