An approach to bound states based on unitary transformations of Hamiltonians is presented. The method is applied to study the interaction between electrons in a BCS $s$-wave superconductor and a quantum spin. It is shown that known results from the t-matrix method and numerical studies are reproduced by this new method. As a main advantage, the method can straightforwardly be extended to study the topological properties of combined bound states in chains of many magnetic impurities. It also provides a uniform picture of the interplay between the Yu-Shiba-Rusinov (YSR) bound states and the Kondo singlet state.