A thiourea-based colorimetric sensor incorporating polyethyleneimine (PEI) and chromophoric nitrophenyl groups was synthesized and utilized for detecting various anions. Structural characterization of the sensor was accomplished using FTIR and 1H-NMR spectroscopy. The sensor’s interactions and colorimetric recognition capabilities with different anions, including CI−, Br−, I−, F−, NO3−, PF6−, AcO−, H2PO4−, PO43−, and SO42−, were investigated via visual observation and UV/vis spectroscopy. Upon adding SO42−, F−, and AcO− anions, the sensor exhibited distinct color changes from colorless to yellow and yellowish, while other anions did not induce significant color alterations. UV/vis spectroscopic titration experiments conducted in a DMSO/H2O solution (9:1 volume ratio) demonstrated the sensor’s selectivity toward SO42−, F−, and AcO−. The data revealed that the formation of the main compounds and anion complexes was mediated by hydrogen bonding, leading to signal changes in the nitrophenyl thiourea-modified PEI spectrum.