Solid-state and solution studies were carried out to reveal the interactions of tetrabutylammonium halides with a sulfadiazine-derived urea, namely 4-{[(4-nitrophenyl)carbamoyl]amino}-N-(pyrimidin-2-yl)benzene-1-sulfonamide, influencing the selectivity in the optical detection of fluoride ions in solution. The self-assemblies of two dimethylformamide (DMF) solvates, three ionic cocrystals, and a salt of the sulfadiazine-derived urea were studied. Both solvates had one DMF molecule anchored by bifurcated hydrogen bonds with the urea moiety, whereas the 1:2 solvate had the second DMF in the interstitial spaces. The structures of the three isostructural ionic cocrystals, namely the tetrabutylammonium halide 4-{[(4-nitrophenyl)carbamoyl]amino}-N-(pyrimidin-2-yl)benzene-1-sulfonamide, where halide is chloride, bromide, and iodide, respectively, were determined. However, the corresponding ionic cocrystal was not formed with tetrabutylammonium fluoride; it afforded the salt tetrabutylammonium (4-{[(4-nitrophenyl)carbamoyl]amino}benzene-1-sulfonyl)-(pyrimidin-2-yl)azanide, which was also structurally characterized. Each ionic cocrystal had charge-assisted hydrogen bonds between the respective halide ion and the N−H bonds of the urea moiety. Homodimeric synthons of the parent compound were observed in the ionic cocrystals; hence, the geometrical adjustment of the dimeric synthons due to the slight changes in the angular shape of the host has the prime role of making available room with the required extra space to accommodate the spherical halide ions with different ionic radii. The fluoride, being basic, caused deprotonation to provide the salt. 1 H NMR and UV−visible spectroscopy was used to discern hydrogen bonds formed by the sulfadiazine-based urea with different halides and the deprotonation by tetrabutylammonium fluoride.