Study of hadrons using the Gaussian functional method in the O(4) linear σ model