Let me show you how acceleration due to gravity using derived:
$F = G \frac {M_E m}{R ^2}$ where $G$ is the universal gravitational constant, $M_E$ is the mass of the Earth, $m$ is the mass of the body, and $R$ is the distance between the body and the centre of the Earth.
Now, $F = mg$.
So, $mg = G \frac {M_E m}{R ^2}$
Simplifying,
$g = G \frac {M_E}{R ^2}$$$g = G \frac {M_E}{R ^2}$$
So, for a body on the earth's surface or even at a height negligible when compared to the earth's radius, the value of acceleration due to gravity $g$ is a constant.