To facilitate intelligent interconnection among people, machines, and things, the next generation of communication technology must incorporate various sensing functions besides high-speed wireless communications. Integration of radar, wireless communications, and spectrum sensing is being investigated for 6G with increased spectral efficiency, enhanced system integration, and reduced cost. Microwave photonics, a technique that combines microwave engineering and photonic technology is considered an effective solution for implementing the integration and breaking the bottleneck problems of electronic solutions. Here, we show a photonics-assisted joint radar, wireless communications, and spectrum sensing system that enables precise perception of the surrounding physical and electromagnetic environments while maintaining high-speed communication. Communication signals and frequency-sweep signals are merged optically using a shared system architecture and hardware to achieve signal level sharing, ultimately simultaneously achieving high-accuracy radar ranging and imaging with a measurement error within ± 4 cm and an imaging resolution of 25 × 24.7 mm, high-data-rate wireless communications at 2 Gbaud, and wideband spectrum sensing with a frequency measurement error within ±10 MHz in a 6 GHz bandwidth.