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.
they cant compare. because the wavelength is different