Quantile and semiparametric M estimation are methods for estimating a censored linear regression model without assuming that the distribution of the random component of the model belongs to a known parametric family. Both methods require estimating derivatives of the unknown cumulative distribution function of the random component. The derivatives can be estimated consistently using kernel estimators in the case of quantile estimation and finite difference quotients in the case of semiparametric M estimation. However, the resulting estimates of derivatives, as well as parameter estimates and inferences that depend on the derivatives, can be highly sensitive to the choice of the kernel and finite difference bandwidths. This paper discusses the theory of asymptotically optimal bandwidths for kernel and difference quotient estimation of the derivatives required for quantile and semiparametric M estimation, respectively. We do not present a fully automatic method for bandwidth selection.