Photoelectric Effect - Work Function Confusion

Work Function is defined as the energy required by a free electron to escape from the surface of a metal. But what happens if the electron which is emitted is not at the surface but a little deep from the surface. In this case what is the energy which brings the electron to the surface of the metal?

• Where did you get that definition? A free electron is not bound and wouldn't require any work to free it from something. – Bill N Apr 3 '18 at 2:18

Then the electron loses kinetic energy before reaching the surface, and an initial energy greater than $W$ is needed in order to eject it. This is one of the reasons why electrons emerge with a continuum of energies, not a single well-defined energy. Another reason is the existence of crud or oxidation on the surface.