Explanation :
Distance is total path travelled by an object during its entire journey. It is a scalar quantity i.e only magnitude.
Displacement is the shortest distance covered by an object. It is basically the change in position of object. It is a vector quantity i.e direction as well as magnitude.
When an object is travelling in a straight line and stops at the end point, then both distance and displacement are same.
When an object is travelling in a straight line and then changes its direction or we can say come backwards then the magnitude of distance and displacement are different.