Glaucoma is an eye disease that is caused by elevated intraocular pressure and commonly leads to optic nerve damage. Thanks to its vital role in transmitting visual signals from the eye to the brain, the optic nerve is essential for maintaining good and clear vision. Glaucoma is considered one of the leading causes of blindness. Accordingly, the earlier doctors can diagnose and detect the disease, the more feasible its treatment becomes. Aiming to facilitate this task, this study proposes a method for detecting diseases by analyzing images of the interior of the eye using a convolutional neural network. This method consists of segmentation based on a modified U-Net architecture and classification using the DenseNet-201 technique. The proposed model utilized the DRISHTI-GS and RIM-ONE datasets to evaluate glaucoma images. These datasets served as valuable sources of diverse and representative glaucoma-related images, enabling a thorough evaluation of the model’s performance. Finally, the results were highly promising after subjecting the model to a thorough evaluation process. The segmentation accuracy reached 96.65%, while the classification accuracy reached 96.90%. This means that the model excelled in accurately delineating and isolating the relevant regions of interest within the eye images, such as the optical disc and optical cup, which are crucial for diagnosing glaucoma.