It is useful to express a function as a combination of sin(kx) and cos(kx) terms because differentiating those functions twice is the same as applying a scale factor (of -k^(2)). In other words, they are eigenfunctions of the operator d^(2)/dx^(2) with the eigenvalue -k^(2).
The whole idea behind Sturm-Liouville theory is that you can change the operator to something else that's amenable to the problem you're trying to solve, which will give you a different set of eigenfunctions that are specific to your problem. Then, you can express other functions as a combination of those eigenfunctions, as a basis.