You should be switching companions based on quests, they level with you even if not in the party. If you look in the quest journal (press j) you will see a recommended party member for that quest.
In terms of composition if you only want to use actual companions I would go
Eder fighter or swashbuckler as a Frontline tank Aloth any class for aoe and cc Maia any class for single target DMG Tekehu druid as a supportive caster
You can swap out tekehu for xoti if she is priest or monk+priest or palegina if you feel like it. Maia can be swapped for anything since single target DPS is usually not that important so use her as your flex slot. Aloth can also make space for anyone just make sure you have aoe cc covered since it makes the game way easier.
In general even in POTD you can make any party comp work and for story you have to be swapping companions that's just the intended way to play there is no optimal choice.