In real world, square and rectangle are different , but if you think logically both has lots of connection with it. Lets see how !
Square can be treated as Rectangle considering side (a) as length (b) and height (h), similarly Rectangle can also be treated as Square if length (b) and height (h) are equal.

You can use the Rectangle formula for Square and get the same equation, here I’m applying (b = h = a) in Rectangle formula
Perimeter of Square = 2(b + h) => 2 (a + a) = 4a
Area of Square = bh => aa = a2
To explore more about mensuration, click any of below topics