By definition, all 4 sides of a square must be equal, which means, if you pick any two sides of a square, their lengths will be equal. Apply this logic to this square and you get
5y-2 = 3y+2
Solve for y
5y-2+2 = 3y+2+2
5y-3y=3y-3y+4
2y=4
(2y)/2=4/2
y=2