A Lanczos-type algorithm for the QR factorization of Cauchy-like matrices