When light moves from one medium to another its speed changes due to the refractive index of the medium and so does its momentum given by $h/λ$. What is the acceleration of photon when it makes transition from one medium to another i.e. when photon leaves denser medium and enters rarer medium or vice versa. Assuming that the photon travels normal to the interface.
The speed of light in vacuum is c measured locally.
When a photon interacts with the atoms in the molecule, three things can happen:
elastic scattering when the photons keeps it energy and phase (mirror and glass), and changes angle
inelastic scattering, when the photon gives part of its energy to the atom and changes angle
absorption, the photon gives all its energy to the atom, and the absorbing electron moves to a higher energy level as per QM
Now the speed of photons is always c when measured locally, because photons always travel in vacuum, except when they are absorbed. But then they get converted into the extra energy of the absorbing electron. So their speed is not defined.
In a medium, speed of light is usually less then c, because the light travels not in vacuum, but in a medium that has atoms and molecules, and the photons have to travel among those. Photons get scattered elastically or inelastically, or absorbed.
It is the EM wave (classical) that is made up of a herd of photons, and that EM wave front travels slower then c in media.
But the individual photons inside the medium always travel in vacuum inbetween the atoms and molecules, and photons always travel with speed c when measured locally.
Why does the EM wave front travel slower in media? Because the media is made up of atoms and molecules and the photons in the EM wave interact with it. Some get elastically scattered, some inelastically, some get absorbed.
In the case of glass, it is elastic scattering, because that is the only way the photons energy and phase can be the same, and a mirror image is built.
The reason for the EM wave front to slow down is because of phase shift, and that is because the photons interact with the atoms and molecules in the glass.
The interaction takes time (average EM interaction time) and so the herd will slow down compared to the speed in vacuum, where there is no interaction with atoms and molecules.
So because of the scattering, and interaction, the wave front will undergo a phase shift, and if you calculate the speed of light in the medium, you will take the distance traveled, divided by the time needed for the wavefront to exit the medium.
The time needed for the wavefront will be more then for a single photon that would travel without interacting, because the wavefront is made up of photons that constantly interact, get scattered by the atoms.
So because of these interactions the wavefront will undergo a phase shift and thus the wavefront will exit the medium in more time then in vacuum.