In a world where the physical size of semiconductor devices is in the nano-region it is very important to understand the electronic properties of semiconductor surfaces and interfaces. These properties can be inferred indirectly from the measurement of work function variations across the surface. Kelvin probe force microscopy (KPFM) is a powerful tool that measures variations of work function and electrostatic potential distribution with nanometer resolution. In this chapter we review several important works that address the relation between KPFM measurements and the electronic or opto-electronic properties of the surfaces measured. We will start by explaining the dependence of the work function on the surface and specifically on surface states. This will be followed by a review on the work done on semiconductor surfaces and interfaces using KPFM. The focus is on correlating surface and interface properties with electro-optic device performance. This chapter is mostly focused on the works done on inorganic semiconductors with only a few examples on organic semiconductors.