Work Function is often confused with escape energy of an electron.
Those two concepts are related but not the same.
The escape energy of an electron from bulk of a conductor through a given surface is the minimum energy that needs to be delivered to an electron near the Fermi level of the conductor to move it outside of the material.
This energy is affected by the surface potentials created by:
- surface dipole layers or by
- surface unbalanced charge densities
because both of those quantities do shift the Fermi level of the conductor with respect to the lowest vacuum level. One can see that the escape energy is a function of both: the properties of the conductor’s material and the conditions (extra charges) it is currently in. In particular, if the conductor is positively charged, the escape energy must increase because the escaping electron must overcome the pull of the positive charge.
The Work Function, on the other hand, is a property of the conducting material alone. Namely, the Work Function is equal to the electron escape energy through a surface, only if the excess charge density of that surface is zero.
This distinction between Work Function and the escape energy has profound consequences for measurement techniques that can be employed to determine the Work Function of a material.
In order to perform such a measurement of a Work Functions through a surface, one needs to make sure that that surface is not charged. In order to remove excess charge from such a surface an appropriate electric voltage needs to be applied between the material and a ground. The voltage shifts the Fermi level of the material with respect to the vacuum energy levels. Thus, the Work Function through a given surface can be defined as the distance in energy between the material’s Fermi level and the bottom of vacuum band
$$
\Phi = E_{\mbox{vac}} - E_F
$$
provided that the surface has no excess charge i.e., a proper potential is applied to the conductor. This way one maintains different Work Functions through different surfaces of the same body. It is possible because the Fermi level $E_F$ is a function of the voltage $V^0$ applied to remove the excess charge from the surface of interest
$$
\Phi = E_{\mbox{vac}} - E_F\left( V^0 \right ).
$$