Lung and colon cancers are deadly diseases that can develop concurrently in organs and undesirably affect human life in some special cases. The detection of these cancers from histopathological images poses a complex challenge in medical diagnostics. Advanced image processing techniques, including deep learning algorithms, offer a solution by analyzing intricate patterns and structures in histopathological slides. The integration of artificial intelligence in histopathological analysis not only improves the proficiency of cancer detection but also holds the potential to increase prognostic assessments, eventually contributing to effective treatment strategies for patients with lung and colon cancers. This manuscript presents an Improved Water Strider Algorithm with Convolutional Autoencoder for Lung and Colon Cancer Detection (IWSACAE-LCCD) on HIs. The major aim of the IWSACAE-LCCD technique aims to detect lung and colon cancer. For noise removal process, median filtering (MF) approach can be used. Besides, deep convolutional neural network based MobileNetv2 model can be applied as a feature extractor with IWSA based hyperparameter optimizer. Finally, convolutional autoencoder (CAE) model can be applied to detect the presence of lung and colon cancer. To enhance the detection results of the IWSACAE-LCCD technique, a series of simulations were performed. The obtained results highlighted that the IWSACAE-LCCD technique outperforms other approaches in terms of different measures.