Black hole spectroscopy beyond Kerr: agnostic and theory-based tests with next-generation interferometers