This transformation only plays a role in the "trivial K-type" formulation of the trace formula, which is only special case of the whole story.
One considers test-functions in the functional calculus of the Laplace-Beltrami operator.
The trace formula describes the trace of a convolution operator on the group level, so the spectral side is parametrized by irreducible representations of the group ${\rm SL}_2({\mathbb R})$, in this case principal series representations, which are parametrized by the parameter $r$.
The corresponding Laplace-Belytrami-eigenvalue is $\lambda=r^2+1/4$. Note that the Laplace-Beltrami operator is induced by the Casimir-operator on the group.

The best way to view the Selberg trace formula is on the group level, where such difficulties disappear. For details see the book
"Principles of Harmonic Analysis" (Springer) by Siegfried Echterhoff and myself.