Error estimates for linear systems with applications to regularization