I know how to handle sample selection bias with Heckman solution in regression but how do I handle this bias if I am doing other tests such as evaluating the difference in means of two groups?
You can write the difference of two means as a regression coefficient. mu1-mu2=b1 with linear model, y=a+b1 + eps in the simplest case. Heckman solution should then apply. See Mendenhall, Intro. to Linear Models and the Design and Analysis of Experiments, Duxbury for details. I can't be more specific since you didn't give your research design. Best wishes.