Functional characterizations of certain $p$-spaces