We show that a change to the quality (Q) factor of a laser diode cavity affects the electrical properties of the device. The mechanism is demonstrated experimentally and numerically via a 980-nm InGaAs/GaAs oxide-aperture vertical-cavity surface-emitting laser (VCSEL) wherewith thin, sub-half-lambda-thick Six Ny layers are deposited on top of the VCSEL's top-coupling distributed Bragg reflector (DBR) mirror to modify the DBR's power reflectance. The presence of such a mechanism enables the detection of a substance that rests on or is in close proximity to the exposed DBR when the substance modifies the Q factor of the laser diode. As an example, we numerically analyze the influence of the change of the refractive index and absorption of a substance in the proximity of a 1651-nm AlInGaAs/InP VCSEL with a top mirror in the form of a monolithic subwavelength high-index contrast grating (MHCG). Such a design enables the detection of methane near the MHCG by changing the properties of the resonating light in the proximity of the grating. We show that this sensing mechanism enables the construction of a new compact optical sensing system without the need for a photodetector.