This is the derivation for gauge pressure inside a fluid. A cylinder has been considered with base area A and height h inside a fluid. The derivation goes along the lines :
The net horizontal forces on the liquid are zero and the vertical forces must balance out the weight of the liquid. Here I don't understand why buoyancy hasn't been considered. But let's put it aside for a second. The difference between the forces exerted on the bottom and top surface must be equal to the wight of the cylinder.
$$(P_{top}-P_{bot})A = mg$$
And,density $\rho = \frac{m}{Ah}$. Therefore,
$$P_{top}-P_{bot} = \rho gh$$
They further say that since area hasn't occurred in the expression, the area/shape of the object doesn't matter (As long as the density doesn't change, right?). And the pressure is same at the same depth at all horizontal points. But if we hadn't replaced $m$ for $\rho$ in the expression, height wouldn't have been in the expression at all! So does height not matter in the first expression, $P_{top} - P_{bot} = \frac{mg}{A}$?