This paper presents a method for characterizing a beam incident on a quadrant photodetector (QPD). The approach is straightforward to implement, as it relies on hardware typically already available for the alignment control of optical cavities in gravitational-wave detectors. It enables measurement of the beam size at the detector plane, allowing for remote adjustment of telescope systems to restore optimal Gouy phase separation. The method has been experimentally validated for beam sizes ranging from 0.05 to 0.5 times the QPD active area, with measurement uncertainties below 12% for small beams and decreasing for larger beams. The novelty of this method relies on the fact that it can also be used to identify stray beams impinging on the QPD, as their presence can significantly degrade the sensor performance. In particular, stray beams may introduce spurious offsets and excess noise in the angular control signals. Consequently, the ability to detect and characterize these beams constitutes a valuable diagnostic capability, facilitating the identification of their origin and the implementation of effective mitigation measures.