One of the most frightening and talked-about diseases in the modern world is cancer. Huge amounts of research are conducted worldwide to make this ailment less fearsome, be it by finding its cure, discovering ways to detect it in much earlier stages to reduce the mortality rate, or identifying precautions for humans to avoid it. The availability of large collections of biomedical and clinical data has ushered in the use of computer vision for cancer detection, especially for two of its most common types, lung and colon carcinomas. In this work, we present a framework wherein both deep learning and meta-heuristic approaches have been used for the prediction of colon or lung cancer, or both, from histopathological images with near-perfect precision. Initially, deep learning models, namely ResNet-18 for 2-class classification and EfficientNet-b4-widese for 3class and 5-class classification, have been trained on the LC25000 dataset, followed by the extraction of deep features. The feature vector obtained from a deep learning model may have some redundancy. Hence, the selection of the most useful features has been done with the application of our proposed hybrid meta-heuristic optimization algorithm, AdBet-WOA (Whale optimization algorithm with integrated Adaptive beta-Hill Climbing local search), utilizing which the Support Vector Machine (SVM) classifier classifies the colon cancer test data, lung cancer test data, and both combined with an accuracy of 99.99%, 99.97%, and 99.96%, respectively, matching the benchmark results comprehensively. For comparison, we have used a few independent as well as hybrid optimization algorithms. Our proposed approach succeeds greatly in reducing the number of features and also leads to better classification performance, as indicated by the obtained results. The relevant codes for our proposed approach are publicly available at: https://github.com/raj- 1411/AdBet-WOA