They all have their uses.
With intervals you cover your structured training. Need to wok on 5m/2m/1m/30s/20s/5s power? Good to go.
Group rides are good to practice riding with groups, following wheel, etc. They are not as good for regular training because the pace is not dictated for you.
Racing is good for pushing yourself past your limits, and finding new ones. It will improve your fitness, but it's not as good as intervals if you need/want to work on specific things.