Plays a role in peptidoglycan recycling by cleaving the terminal beta-1,4-linked N-acetylglucosamine (GlcNAc) from peptide-linked peptidoglycan fragments, giving rise to free GlcNAc, anhydro-N-acetylmuramic acid and anhydro-N-acetylmuramic acid-linked peptides (By similarity). Contributes to intrinsic fosfomycin resistance in P.aeruginosa (PubMed:24819062). Hydrolysis of terminal non-reducing N-acetyl-D-hexosamine residues in N-acetyl-beta-D-hexosaminides. Cell wall biogenesis; peptidoglycan recycling. Monomer. Deletion of this gene increases fosfomycin sensitivity. Belongs to the glycosyl hydrolase 3 family. NagZ subfamily.