Theory and Applications of Waveguide QED and Quantum Circuits Using Matrix Product States