The vulnerability of karst ecosystems and the weak mechanical performance of caves pose hidden risks in railways, leading to increased karst collapses. To analyse karst collapse as a railway hazard, the Beijing–Guangzhou railway line in China was selected to identify karst features, using the multi-source frequency domain method because of its operational advantages. Abaqus was also used to numerically analyse the factors (dynamic loading, groundwater fluctuations, over-burden thickness) affecting the collapse mechanism. The study reveals diverse stratigraphy, transitioning from a Quaternary layer to stable rock formations. A notable finding is that the presence of a karst cavity in the railway embankment significantly increases the vertical dynamic displacements, particularly within the soil layer, by 72%, highlighting the significant impact of karst sections on soil dynamics. The study also reveals that due to the groundwater table fluctuations from the subsoil surface to the subgrade surface, the maximum displacement increases by 73% in the subgrade section of the railway embankment. The authors consider soil overburden thickness to validate confirmation of reliability through field data and theoretical study. The findings offer crucial insights for managing karst hazards, enhancing railway safety and ensuring durable infrastructure in challenging geological conditions.