In similar systems, the position is generally tracked with the combination of interial sensors (accelerometer / gyro / angular rate sensors) and external references like GPS and star trackers.
Inertial sensors are able to provide high frequency data on change in position and orientation. Higher frequency means the software can make much more rapid decisions to steer the rocket, on the order of 1000 a second or so, much more often than can be achieved with GPS.
The fact that inertial sensors don't rely on external signals (like GPS does) means that there is some degree of robustness- for instance, if there is a temporary disruption in GPS signal reception, the rocket will still have some idea of its position.
Over time, integration and measurement error accumulate from the inertial sensors. (Remember that they generally measure changes in position / orientation, not absolute position or orientation). For this reason, it is usually necessary to use external position and orientation references to correct the error that accumulates over time. GPS is used for this, and in some applications, star trackers can be used as an absolute orientation reference.
On the algorithm side, a Kalman filter combines measurements from all of the position and orientation sensors to generate a prediction of the current position / orientation / velocity / acceleration etc.