Disclosed is an electronic device includes a housing, a display within the housing, and exposed through a surface of the housing, a light emitting unit and a light receiving unit within the housing, and a processor electrically coupled with the display, the light emitting unit and the light receiving unit. The light emitting unit includes at least one light source for outputting light of at least one wavelength band. The light receiving unit includes at least one region for receiving the light of the at least one wavelength band. The processor is configured to control a function of the light emitting unit and/or the light receiving unit based on at least one mode. Other embodiments are disclosed.