Geological disasters in the Emei to Mianning section of the Chengdu–Kunming Railway located in southwestern China occur frequently, and many debris flow gullies are distributed along the line. Debris flows often cause damage to the railway and highway that threatens the safe operation of the original line and the double-track line. Along the railway, the debris flow outbreak risks are analyzed for 53 debris flow gullies using field survey, remote sensing interpretation, and numerical simulation. Their developmental characteristics were judged according to the code. The results are used for numerical simulation of debris flow to further determine the movement characteristics and the accumulation range of debris flow. The results are combined with high-definition satellite images to analyze the form of the railway passing from the mouth of the ditch and the simulation results to determine the impact on the safe operation of the Chengdu–Kunming Railway when the debris flow erupts. Finally, disaster prevention and mitigation projects are proposed, and the prevention and control effects of the proposed works are validated.