Stability for functional and geometric inequalities