Still, the type of campaign, and DM strengths/weaknesses or even DM preferences or biases, will be key when determining how "fun" it is to play less optimized PCs.
When I run a game (and when I design my own campaigns) I try to balance the three pillars (combat, interaction and exploration) so that it is more likely that a PC that has strengths and weaknesses will find opportunities to shine (or have fun failing in some situations as well).
In some of my campaign play over the past few years, the melee optimized Half-Orc fighter, while superior in melee combat, has not overshadowed the rogues, bard, wizard, paladin or cleric because there are many situations where melee combat is not the best course of action, or when combat versus hoards of opponents is better met by a area of effect spell from the wizard, bard or cleric.
At one point in one of my campaigns, a player in my group played a noble cleric that avoided combat and had disdain for getting dirty. This made him play "less optimally" but it added a wealth of character enhancing the group dynamic of the party. In a group that accepts this type of play, the "less optimal" PC can make the game more interesting. On the other hand, if all the players in the group are purely team goal, achievement oriented, playing the "less optimal" PC can lead to problems.
Surely, bounded accuracy helps to allow for more or less optimized PCs to play together, to a point, but more importantly I think the roleplaying aspects of the game including PC personality traits, flaws, bonds, etc, and the conscious acceptance of story and character development rather than a hard focus on just killing monsters or solving problems efficiently, is the key to sustaining a campaign with sub-optimal PCs.
To this, even the frequency that a DM grants inspiration (or advantage) to players (or has players grant it to other players, whatever option is used) can make it more likely that sub-optimal PCs contribute to the game. A player with a low attribute PC that plays to his/her flaws, traits, bonds, etc. and has access to extra die rolls at interesting times may nullify the purely mechanical disadvantage pure modifiers would set up.
Overall, the ability to play sub-optimal PCs and make sub-optimal decisions and balance the game in ways that give DM and players what they want, is one of the reasons why I really do like 5e better than other versions of the game.