Can a commercial airplane overtake another airplane going in the same direction?
Faster aircraft often overtake slower on the same routing. This is usually accomplished by flying at higher or lower altitudes. This is called vertical separation. They can also be separated laterally by radar vectors so that they are 3-5 nautical miles apart. The exact distance will depend on the ATC standards for the particular airspace.

Often as they approach the destination ATC will ask one aircraft to speed up and one to slow down slightly. This can sometimes allow the faster aircraft to pass the slower aircraft, but it also insures they have the required separation when they are on approach to land.