Play with the people who want to play, ignore those who don't
If you have two players who consistently want to play D&D and show up to do so you've got a solid foundation for your game. Rather than altering the game to appease people who don't really want to play (and aren't showing up) focus on these two who do want to play.
Do not award experience to characters that aren't present.
Experience, treasure, and story integration are the big three things you have available to make players feel rewarded. Handing them out unearned takes away from the game and can demotivate the kind of player that enjoys these kinds of rewards. This will naturally mean that players who show up less often will fall behind but that isn't much of a problem in 5e. If a large level gap forms address it the same way you would a character death, possibly by letting the low attendance player introduce a new higher level character. Never just bump up a low level character who hasn't earned it.
If a player isn't going to come this week but the character is involved in the adventure just have someone else play that character.
This definitely ruffles some people's feathers as they see the character as absolutely theirs, but they aren't playing this week so forget about them. Make it clear that all of the characters belong to the game/story and will be used as needed. Keep track of the character sheets yourself so you've always got the information available. If a character dies while their normal player isn't present that's a damn shame, but the way things go. If someone really doesn't like the idea of their character being played without them they are welcome to make the time to play.
If a player wants to play this week but their character isn't easily involved in the current adventure, just hand them an NPC or decline to have them this week.
This can come up easily if you're running dungeon crawls that can span multiple sessions, and particularly in situations where the characters don't start each session with a long rest. It is important not to suddenly teleport in characters who weren't previously present as this can throw off the balanced of consumed resources (spells/hp/potions) by adding a fresh pool. Instead allow the player to play an NPC for the session. This way the player still gets to play, the encounter balance stays the same, and the players who played last week aren't overshadowed by someone with fresh resources.
Alternatively if no suitable NPC is available just decline to have the incoming player play this week. Sometimes you're building toward a big pay off there's no easy way to jump in to the middle. This will likely turn off some players who prefer to come and go, but rewards the players who are consistently at your game.
When designing encounters consider that the party may have an extra person or two and make a note of how it could be scaled.
Additional creatures are an easy way of expanding encounters with groups of similar creatures. Solo-Bosses can be more of a problem as the action economy is already tipped against them. For these cases consider granting additional lair actions and HP to keep the boss at pace with a larger party. Room size and layout can be a problem with very large scaling but if it's only +/- 1 or 2 characters will generally be fine.
To Summarize: The show must go on.
You've got a solid base of players who want to play on a regular basis, and a DM who wants to run a game of a regular basis. Don't disappoint the people who want to play now by stalling the game for people who say they want to play later. Run your game and don't concern yourself overmuch with those who don't make it.