Quaternary ammonium compounds (QACs) are widely used in disinfectants, cleaners, preservatives, cosmetics, and agriculture. Recently, QACs have been detected in the human bloodstream, breast milk, and neonatal mouse brain, which shows that these compounds can cross biological barriers. In vivo studies showed that chronic low-level exposure to QACs causes developmental, reproductive, and immune dysfunctions, whereas in vitro studies indicate that QACs can affect reproductive systems, disrupt cholesterol biosynthesis, increase inflammatory cytokines, and decrease mitochondrial functions. Effects of QACs on health are gradually emerging, amid increased use of QAC disinfectants during the COVID-19 pandemic. Analysis of biological fluids including blood, urine, sweat, and saliva can provide vital information in determining the biological effects of analytes. Biofluid analysis is convenient yet crucial because of non-invasive/or minimally invasive procedures that can be performed outside hospital settings. Interest in optical detection methods for biofluid analysis has been growing due to recent advances in detection technologies and availability of tunable materials to aid the technologies. Detection in the near-infrared (NIR) spectral range is advantageous over the visible range mainly due to minimal autofluorescence, light-scattering, and absorption from native biological molecules in the NIR range. Photoluminescent single-walled carbon nanotubes (SWCNTs) are promising candidates for the development of NIR optical probes and sensors due to their non-photobleaching NIR fluorescence, tunable surface chemistry, and high sensitivity. Herein, we report optical detection of QACs in protein-rich media and a model biofluid. We functionalized photoluminescent SWCNTs with bile salt derivatives that enabled the detection of QACs in artificial sweat and serum-protein-enriched media. The QAC detection was significant at nanomolar concentrations, which is within the threshold that can affect various physiological processes. Thus, nanotube-based optical detection could be well suited for the analysis of QACs in biological fluids.