Near-infrared (NIR) spectroscopy, known for its non-destructive, rapid, and precise nature, captures spectral responses to chemical bond changes in cancerous tissues. This provides a promising approach for accurate cancer staging and identifying spectral differences between cancerous and healthy tissues. In this study, NIR data from esophageal lesions excised via endoscopic submucosal dissection were analyzed using partial least squares discriminant analysis (PLS-DA) to classify normal tissues, low-grade, and high-grade intraepithelial neoplasia, confirming its feasibility for staging diagnosis. To enhance wavelength selection, the FOX algorithm, a swarm intelligence optimization method, is improved with two modifications: a nonlinear time-varying sigmoid transfer function and mirror selection. These enhancements are combined to form an improved FOX algorithm (iFOX) for wavelength selection. iFOX effectively enhances the algorithm's stability while enhancing classification performance.