Cancer remains a leading reason of mortality, with the current global death toll estimated at 10 million and projected to surpass 16 million by 2040 as reported by the World Health Organization (WHO). In addition to the devastating loss of lives, incorrect cancer diagnoses and medical errors further contribute to the mortality rate. To address these challenges, there is an urgent need for automated and computerized diagnostic techniques that can reduce errors and improve the treatment of cancer patients. In the recent decades, extensive investigation has centred on developing automatic and accurate detection techniques for various categories of cancer. This article exhibits a thorough review of five categories of cancers: pancreatic, esophageal, prostate, colorectal, and leukemia, utilizing both classical machine learning (ML) and deep learning (DL) methods. Notably, the selection of these cancers arises from both their lethal impact and the observed scarcity of consolidated literature surveys encompassing these specific types. A total of 191 peer-reviewed publication are considered which were published spanning the years 2018 to 2023. The analysis and review of cancer detection techniques were conducted separately for ML and DL models, with 87 articles focusing on ML-based techniques and 104 articles focusing on DL-based techniques. The study, a synthesis of diverse research endeavors, offers a comparative dissection of the best and worst performing classifiers. Additionally, it illuminates overarching findings and confronts challenges, encapsulating a compendium of insights crucial for the trajectory of future research. We put emphasis on the magnitude of advancements in diagnostic methods and the choice of appropriate classification models. Additionally, we highlight the significance of feature engineering techniques in advancing cancer detection performance. By consolidating the findings of numerous research articles and analyzing the advantages and limitations of distinctive methodologies, this study contributes to the ongoing efforts to improve cancer detection methods. The results underscore the pressing need for reducing medical errors and advancing the field of cancer diagnosis and treatment.