Lung cancer is the leading cause of cancer-related deaths worldwide, highlighting the importance of early detection to improve patient outcomes. The goal of this study is to create a computer-aided diagnosis (CAD) system that detects and classifies lung cancer based on medical images using a Convolutional Neural Network (CNN) and feature extraction techniques. By automating the process and reducing reliance on manual interpretation, the goal is to improve the accuracy and efficiency of lung cancer diagnosis. The study employs the LIDC-IDRI dataset, a comprehensive collection of lung cancer-related medical images, to achieve this goal. To improve the visual representation of the images, pre-processing techniques are used. The RGB images are converted to grayscale using a formula that considers the human perception of colour intensity. The images are then subjected to median filtering to reduce noise and smooth out irregularities. In addition, Contrast Limited Adaptive Histogram Equalization (CLAHE) is used to improve contrast and detail while reducing noise. To segment regions of interest based on grey-level intensities, thresholding techniques, specifically Otsu's thresholding, are used. The Sobel operator is used to refine the segmentation process by enhancing edges and contours in binary images. Morphological operations such as dilation and filling are used to refine the segmented regions even further. Feature extraction is used to extract statistical data and texture characteristics from segmented regions. Mean and variance calculations reveal information about brightness and variability within regions, whereas co-occurrence matrices and Gray-Level Co-occurrence Matrix (GLCM) properties quantify texture features. The correlation between different regions is also evaluated to assess their relationships. The t-test statistic is used to rank all extracted features based on their relevance. Using the pre-processed and ranked features as inputs, a CNN model with five hidden layers is trained. To classify the segmented regions into cancerous and non-cancerous classes, the model learns patterns and relationships in the data. A confusion matrix is used to assess the accuracy, specificity, and sensitivity of the model's predictions, with an emphasis on correctly identifying lung cancer-affected regions. The results show promising results, with the proposed CAD system identifying lung cancer-affected regions with an accuracy of 99.4375%. The system also outperforms other existing methods with a specificity of 99.12% and a sensitivity of 99.26%. These findings highlight the developed system's potential as a valuable tool for early lung cancer detection, assisting doctors in making accurate diagnoses and improving patient outcomes.