Distribution function approach to redshift space distortions. Part III: halos and galaxies