In a recent paper [Phys. Rev. Lett. 93, 130401 (2004)], we proposed the idea of expanding the space of variations in variational calculations of the energy by considering the approximate wave function to be a functional of functions , , rather than a function. A constrained search is first performed over all functions such that the wave-function functional satisfies a physical constraint or leads to the known value of an observable. A rigorous upper bound to the energy is then obtained via the variational principle. In this paper we generalize the constrained-search variational method, applicable to both ground and excited states, to the determination of arbitrary Hermitian single-particle operators as applied to two-electron atomic and ionic systems. We construct analytical three-parameter ground-state functionals for the ion and the He atom through the constraint of normalization. We present the results for the total energy , the expectations of the single-particle operators , , , and , the structure of the nonlocal Coulomb hole charge , and the expectations of the two particle operators , where . The results for all the expectation values are remarkably accurate when compared with the 1078-parameter wave function of Pekeris, and other wave functions that are not functionals. We conclude by describing our current work on how the constrained-search variational method in conjunction with quantal density-functional theory is being applied to the many-electron case.