Rhodamine 6G (R6G) and 4-nitro-2,1,3-benzoxadiazole (NBD) linked through a spacer molecule spermidine (spd), R6G-spd-NBD, produces a fluorescent probe with pH-sensitive FRET (Förster (fluorescence) resonance energy transfer) effect that can be useful in a variety of diagnostic applications. Specifically, cancer cells can be spotted due to a local decrease in pH (Warburg effect). In this research, we applied this approach to intracellular infectious diseases-namely, leishmaniasis, brucellosis, and tuberculosis, difficult to treat because of their localization inside macrophages. R6G-spd-NBD offers an opportunity to detect such bacteria and potentially deliver therapeutic targets to treat them. The nanogel formulation of the R6G-spd-NBD probe (nanoparticles based on chitosan or heparin grafted with lipoic acid residues, Chit-LA and Hep-LA) was obtained to improve the pH sensitivity in the desired pH range (5.5-7.5), providing selective visualization and targeting of bacterial cells, thereby enhancing the capabilities of CLSM (confocal laser scanning microscopy) imaging. According to AFM (atomic force microscopy) data, nanogel particles containing R6G-spd-NBD of compact structure and spherical shape are formed, with a diameter of 70-100 nm. The nanogel formulation of the R6G-spd-NBD further improves absorption and penetration into bacteria, including those located inside macrophages. Due to the negative charge of the bacteria surface, the absorption of positively charged R6G-spd-NBD, and even more so in the chitosan derivatives' nanogel particles, is pronounced. Additionally, with a pH-sensitive R6G-spd-NBD fluorescent probe, the macrophages' lysosomes can be easily distinguished due to their acidic pH environment. CLSM was used to visualize samples of macrophage cells containing absorbed bacteria. The created nanoparticles showed a significant selectivity to model E. coli vs. Lactobacillus bacterial cells, and the R6G-spd-NBD agent, being a mild bactericide, cleared over 50% E.coli in conditions where Lactobacillus remained almost unaffected. Taken together, our data indicate that R6G-spd-NBD, as well as similar compounds, can have value not only for diagnostic, but also for theranostic applications.