The environment near substations is complex, and electrocution accidents of operators occur from time to time during on-site operations, and the development of safety detection models for substation operations has received more and more attention. The article proposes a safety distance detection model for substation operation, which is mainly composed of binocular stereo matching perception model and safe area detection model. The binocular stereo matching perception is based on the PSMNet network model, combined with the parallax regression calculation to obtain the threedimensional coordinates of the operation area in the process of substation operation, and the threedimensional reconstruction of the substation operation process. The spatial context inference algorithm is utilized in the safe region detection model to detect the edge of the safe region, and the image segmentation of the safe region of the substation operation scene is performed by the improved OTSU algorithm. Then the three-dimensional coordinates obtained from binocular stereo matching perception and the three-dimensional coordinates of safe region detection are solved for the Euclidean distance, and then the safe distance detection of substation operation is realized. The EPE result accuracy of binocular stereo perception matching on the dataset is reduced by 0.71px compared with CRL, and the resulting mismatch pixel rate is between 0.83 and 1.48%. The average time-consuming image segmentation of the improved OTSU threshold segmentation method is 6.34ms, and the average relative error of the safety distance detection for substation operation is only 0.85%, and the maximum absolute error of the safety distance detection is only 0.13 m. Combining the spatial contextual reasoning algorithm with the deep learning technology can realize the effective detection of the safety distance for substation operation in multiple scenarios, and fully ensure the operation of the substation workers’ safety.