Commensurating endomorphisms of acylindrically hyperbolic groups and applications