Road accidents are a significant negative outcome of transportation systems, causing injuries, fatalities, traffic congestion, and economic losses. As cities expand and the number of vehicles on the road increases, traffic accidents (TAs) have become a significant problem. Studies have shown that urban development plays a more significant role in transportation safety than previously thought. Low-income countries have higher fatality rates than high-income countries, according to the Permanent International Association of Road Congress (PIARC) and the World Health Organization (WHO). Predicting and preventing the occurrence of accidents and congestion is necessary worldwide, especially in developing countries where fatality rates are higher. The objective of this study is to examine and make a comparative analysis in low-income and high-income countries of the existing literature on the global challenge of car accidents and use its prediction techniques to enhance road safety and reduce traffic congestion. The study evaluates various approaches such as logistic regression, decision tree, random forest, deep neural network, support vector machine, random forest, K-nearest neighbors, Naïve Bayes, empirical Bayes, geospatial analysis methods, and UIMA, NSGA-II, and MOPS algorithms. The research identifies current challenges, prevention ideas, and future directions for preventing accidents and congestion on the road network. Integrating GIS-based spatial statistical methods and temporal data and utilizing advanced optimization algorithms and machine learning methods can result in accurate prediction models that can help identify accident hotspots and reduce congestions and enhance traffic safety and mitigate their occurrence. Effectively preventing urban traffic congestion requires the integration of spatial data into precise accident prediction models. By employing spatial analysis, road safety planning can be enhanced, high-risk areas can be identified, interventions can be evaluated, and resources can be optimally allocated to facilitate effective road safety measures and decision-making, especially in settings with limited resources. Therefore, it is crucial to consider ML and spatial analysis techniques and advanced optimization algorithms to enhance traffic flow control, in road safety research and transport planning efforts.