  We use the Dirac operator technique to establish sharp distance estimates for
compact spin manifolds under lower bounds on the scalar curvature in the
interior and on the mean curvature of the boundary. In the situations we
consider, we thereby give refined answers to questions on metric inequalities
recently proposed by Gromov. This includes optimal estimates for Riemannian
bands and for the long neck problem. In the case of bands over manifolds of
non-vanishing $\hat{\mathrm{A}}$-genus, we establish a rigidity result stating
that any band attaining the predicted upper bound is isometric to a particular
warped product over some spin manifold admitting a parallel spinor.
Furthermore, we establish scalar- and mean curvature extremality results for
certain log-concave warped products. The latter includes annuli in all
simply-connected space forms. On a technical level, our proofs are based on new
spectral estimates for the Dirac operator augmented by a Lipschitz potential
together with local boundary conditions.
