The sliding contact has the effect of separating the potentiometer into two parts – an upper part and a lower part – both of which have different resistances
Moving the slider changes the resistances (and hence potential differences) of the upper and lower parts of the potentiometer