It is preferable to have the team with heroes of the same type, full tank etc, but it depends on the opponent, changing a hero helps and using a 4+1. Full tank is the first choice and the easiest choice. But now the meta is full planes. Planes have a big advantage over tanks, they nerf energy damage (Kim, stetman) because of the two heroes that are in front, Carrie and Lucius

following are suggested hero teams:

The classic setup

for tanks from left to right: front Williams | Murphy. Back Marshall | Kim | Stetman

For aircraft front Carlie | Lucio back Schuyler | DVA | Morrison

For cannons front McGregor | Adam. Back Fiona | Tesla | Swiftt

In general, the strongest defender should be at the front left (shield symbol). at the back middle the strongest damage dealer. at the back right the 2nd strongest. at the back left the one with buffs

There are currently formations against certain classes. e.g. tank team vs stronger tank team: Murphy out, Lucio ren.

tank vs aircraft: Stetman out, Swiftt in

It can also help to strengthen the tank team with Schuyler (Stet out). 20% stun possibility and damage bonus against tank