This study introduces a potentiometric pH sensor that is extremely sensitive and specifically designed for food and pharmaceutical applications. The sensor utilizes a pH-sensitive interface fabricated by electropolymerizing polyaniline (PANI) on carbon fiber cloth (CFC). Structural and morphological analyses of PANI-CFC and CFC have been conducted by using X-ray diffraction (XRD), field emission scanning electron microscopy (FESEM), and X-ray photoelectron spectroscopy (XPS). The investigation of the functional groups was conducted by using Fourier transform infrared spectroscopy (FTIR) and Raman spectroscopy. The electrochemical characteristics were assessed by utilization of cyclic voltammetry (CV) and open-circuit potential (OCP) measurements in a three-electrode configuration. The sensor exhibited a sensitivity of 60.9 mV/pH, while retaining consistent performance within the pH range of 4 to 12. The repeatability and robustness of the sensors were verified. The accuracy of the PANI-CFC sensor was confirmed by validation using real samples, demonstrating its compatibility with commercially available pH sensors. The application of density functional theory (DFT) calculations revealed an interaction energy of -173.2886 kcal/mol, indicating a strong affinity of H+ ions towards PANI-CFC electrode. Further investigation was conducted to examine the chemical reactivity of PANI, revealing a HOMO-LUMO energy gap of -0.98 eV. This study highlights the PANI-CFC sensor as a reliable and efficient pH-sensing platform for food and pharmaceuticals applications, performing robustly in both laboratory and real-world settings.