Dipolar aprotic solvents, including dimethyl sulfoxide (DMSO), account for 20 % of organic solvents used in organic synthesis, pharmaceutical development, and industrial processes because of their excellent solubility. However, there is a lack of sensors for the easy and real-time identification of dipolar aprotic solvents. To address this challenge, in this study, a U-shaped evanescent optical fiber (UOFE) sensor was developed by electrospinning polyacrylonitrile (PAN) combined with a Ti3C2 MXene/TiO2 hybrid to detect DMSO gas. UOFEs equipped with PAN/Ti3C2 MXene/TiO2 nanofibers demonstrated remarkable sensitivity towards DMSO, primarily owing to the dipole-dipole interactions, DMSO solubility, and refractive index changes. The cross-sensitivity of the sensor to dipolar aprotic solvents, such as N,N-dimethylacetamide, N,N-dimethylformamide, 1-methyl-2-pyrrolidone, and γ-butyrolactone, was demonstrated and the developed sensor selectively detected DMSO gas. The superior performance of the UOFEs was attributed to the synergistic effects of the electrospun PAN/Ti3C2 MXene/TiO2, thereby enhancing the gas diffusion properties and facilitating efficient interaction with DMSO. These results highlight the potential of combining electrospun nanofibers and optical fibers for gas sensing applications, such as indoor air-quality monitoring, environmental protection, and industrial safety.