The distance from a point to a line is defined as the shortest distance, which is trough the perpendicular segment from the point to the line. Let's consider the given diagram.
We see that the segment that measures 24 centimeters is not perpendicular to PQ. Conversely, the segment that is perpendicular to PQ measures 16 centimeters. The distance from point A to PQ is 16 cm.