The three-fermion problem in two and three dimensions; a unified variational approach