Optical sensors have more capabilities than electronic sensors, and therefore provide extraordinary developments, including high sensitivity, nonsusceptibility to electromagnetic wave disturbances, small size, and multiplexing. Furthermore, fiber Bragg grating (FBG) is an optical sensor with a periodically changing grating refractive index, susceptible to strain and temperature changes. As a sensor, FBG's performance required to optimize and improve the numerical apodization function and affect the effective refractive index is considered. The grating fiber's apodization function can narrow the full width half maximum (FWHM) and reduce the optical signal's side lobes. In all the apodization functions operated by FBG, Blackman has the highest sensitivity of 15.37143 pm/°C, followed by Hamming and Gaussian, with 13.71429 pm/°C and 13.70857 pm/°C, respectively, and Uniform grating fiber with the lowest sensitivity of 12.40571 pm/°C. Hamming, Uniform, and Blackman discovered the sensitivity for a strain to be 1.17, 1.16, and 1.167 pm/microstrain, respectively. The results obtained indicated that apodization could increase FBG's sensitivity to temperature and strain sensors. For instance, in terms of other parameters, FWHM width, Hamming had the narrowest value of 0.6 nm, followed by Blackman with 0.612 nm, while Uniform had the widest FWHM of 1.9546 nm.