First we recall a method of computing scalar products of eigenfunctions of a Sturm-Liouville operator. This method is then applied to Macdonald and Gegenbauer functions, which are eigenfunctions of the Bessel, resp. Gegenbauer operators. The computed scalar products are well defined only for a limited range of parameters. To extend the obtained formulas to a much larger range of parameters, we introduce the concept of a generalized integral. The (standard as well as generalized) integrals of Macdonald and Gegenbauer functions have important applications to operator theory. Macdonald functions can be used to express the integral kernels of the resolvent (Green functions) of the Laplacian on the Euclidean space in any dimension. Similarly, Gegenbauer functions appear in Green functions of the Laplacian on the sphere and the hyperbolic space. In dimensions 1,2,3 one can perturb these Laplacians with a point potential, obtaining a well defined self-adjoint operator. Standard integrals of Macdonald and Gegenbauer functions appear in the formulas for the corresponding Green functions. In higher dimensions the Laplacian perturbed by point potentials does not exist. However, the corresponding Green function can be generalized to any dimension by using generalized integrals.