The study's focus is on lung nodules, which are frequently connected to lung cancer, the world's most common cause of cancer-related deaths. In clinical practice, a timely and precise diagnosis of these nodules is essential, albeit difficult. For diagnosis, the study used CT scans from the Lung Image Database Consortium and the LIDC-IDRI dataset. Noise reduction with a Gaussian Smoothing (GS) Filter and contrast enhancement were part of the preprocessing. With a Dual-path Multi-scale Attention Fusion Module (DualMAF) and a Multi-scale Normalized Channel Attention Module (MNCA), the study presented the LNS-DualMAGNet model for lung nodule segmentation. These modules improve interdependence across channels and semantic understanding by utilizing novel approaches such as Depthwise Separable Convolutions and attention mechanisms. For increased performance, the model also incorporates DSConv and a Resnet34 block. The Dung Beetle Optimization Algorithm (DBOA) was used for tuning the hyperparameter of the proposed classifier. Findings indicated that the proposed model performed better than the existing approaches, attaining a 0.99 accuracy and DSC, indicating its potential to enhance lung nodule segmentation for clinical diagnosis.