S is always the displacement and never the distance.
Hmm well here is a Question that says :
a book falls off the top of a bookcase.the shelf is 1.4m above the a wooden floor . (a) find the time the book takes to reach the floor , (b) the speed with which the book strikes the floor .
here we used the 1.4m as distance in the Equation I mentioned Prior , while in another Question :
A ball is projected vertically upwards ,from a point X which is 7m above the ground , with speed 21 m/s .Find (a) the greatest height above the ground reached by the ball , (b) the time of flight of the ball
here we used displcement as -7 , hence in the Equation S was used as Discplacement .
y there as distance and here as dicplacement