Conformal dispersion relations for defects and boundaries