Work function is a property of metal surface, not bulk material, which is infinite by definition, i.e., has no vacuum region. It means that there is no relation between the Fermi energy of bulk material and work function of a particular surface. For a surface, the Fermi level can be defined with respect to the vacuum level. In this case, the absolute value of the Fermi energy is work function of that particular surface.
The actual problem is that there exists no absolute reference zero energy. That is why comparing absolute energies obtained in two separate calculations, e.g., for bulk and surface systems, makes little sense.