In remote sensing, ground sample distance (GSD) refers to the dimensions of a single pixel in an image as measured on the ground. The calculation of GSD uses the focal length (FL in figure below) and sensor array dimensions, which are properties of the sensor, as well as the distance between the sensor and the ground at the moment of image capture (D in figure below), normally represented by the altitude of an aircraft or orbital distance of a satellite.
Here is a visual aid to illustrate:
So when the ground is flat, things are as you described and the distance D is similar across the entire image which means that spatial resolution and GSD are equal across the scene (("1" above). However, since spatial resolution can be used to describe the dimensions of a pixel relative to any object in focus, consider two other scenarios. First, some objects can stand relatively high above the ground compared to the altitude of a low flying aircraft ("2" above). Second, image footprints can cover large areas which contain variable surface relief ("3" above). In both of these scenarios, the spatial resolution of objects across the image would deviate from the correctly calculated GSD in such a way that objects closer to the sensor than the ground are more resolute, and those farther away are less resolute.
So in short, Spatial resolution refers to the size of the pixels in an image with respect to some real world object in focus, and GSD is a standardized metric used to describe the spatial resolution of remotely sensed imagery on the ground, while image resolution without georeferencing typically refers to solely to the number of pixels in the sensor array, which is the product of the height and width and usually expressed in megapixels (i.e., 8192 × 5460 = ~45MP). The former two describe the size of the smallest detectable features within a particular image, while the latter describes the level of detail recorded by a particular sensor configuration.