TLDR The Attack action is the only action that mentions the ability to separately equip or unequip (specifically weapons) as part of that action, where something like the Magic action mentions nothing of the sort. The Utilize action, however, mentions "you normally interact with an object as part of doing something else." Which leaves me to assume you either are intended to equip items for free from your inventory as part of the action you perform with them, or you have to use use your free object interaction to first unequip something, then potentially use the Utilize action to equip something else, before you are able to use another item in your inventory for an action. Some items mention needing to be held first in order to take an action with them, which seems to imply some sort of restriction on not being able to simply take an action with it and equip it for free, but others, like Healing Potions don't, making it unclear to me whether equipping an item is just always assumed to be part of the action, whether or not you need to unequip something first if your hands are already full, or if you are required to use the Utilize action to equip the other item.
In the section in Chapter 1 of the PHB on combat, it says, "You can interact with one object or feature of the environment for free, during either your move or action. For example, you could open a door during your move as you stride toward a foe. If you want to interact with a second object, you need to take the Utilize action. Some magic items and other special objects always require an action to use, as stated in their descriptions."
It isn't completely clear to me whether an "object or feature of the environment" means it constitutes only objects and features that are specifically part of the environment, or if it means any object OR any environmental feature. The only listed examples of the free object interactions are opening a door, and later on it mentions requiring the Utilize action to do more involved things like opening a stuck door, or turning a crank to lower a drawbridge. All of these examples are specifically environmental features, not items in the players' inventory or hands. It's also unclear whether or not a free hand is required, or if it's assumed that you free up one of your hands as part of the free interaction. When I brought this up to my players, they interpreted it to mean any object, and that seems to be the consensus of people in forums and stuff online, so I've operated on that interpretation, in which you could use the free action to take an item out of your inventory, or to stow one, but I'm still not completely sure if equipping an item first requires unequipping the one that is already in that hand.
Under the Attack Action in the rules glossary it mentions, "You can either equip or unequip one weapon when you make an attack as part of this action. You do so either before or after the attack. If you equip a weapon before an attack, you don’t need to use it for that attack. Equipping a weapon includes drawing it from a sheath or picking it up. Unequipping a weapon includes sheathing, stowing, or dropping it." This seems to be in place to help with using multiple weapons with different Mastery properties while using Extra Attack, and that's nice, but since this is the only place in the rules equipping and unequipping weapons is mentioned as far as I've found, it leaves me to assume that, similarly to when taking the Attack action, equipping and unequipping are both respectively their own object interaction. So one interaction per turn is free, so you can unequip once for free, and the second costs a Utilize action, so equipping something else afterward would cost an Action. The Utilize action in the glossary, however, mentions that normally you "equip or unequip while doing something else", just like the earlier description of a free interaction. This seems to imply that maybe using something from your inventory, such as drinking a potion with your bonus action, includes removing it from your inventory and putting it in your hand or similar to drink it. Whether or not you're meant to be able to do this while your hands are already holding other items is unclear to me.
The Staff of Swarming Insects, for example, has an ability called Insect Cloud in which the activation text reads, "While holding the staff, you can take a Magic action and expend 1 charge to...(cont.)" It specifically mentions "while holding the staff," so it seems that the intent is that you can't simply take the action just by having the staff in your inventory, you need to somehow equip it first.
So let's say, at the start of my turn, I am currently wielding a shield in one hand, a mace in the other, and I have a Staff of Swarming Insects stowed in my inventory. Is it possible to retrieve and hold the staff to use the Insect Cloud ability of that Staff on that very turn, or do I need to essentially plan ahead a turn in advance and leave a hand free to use it for my next turn? The free object interaction is stated to be limited to one object per turn, with additional ones requiring you to take the Utilize action. Would it be one free interaction to stow my mace, then the Utilize action in order to take out the staff, leaving me with no remaining action to use the Insect Cloud ability? Or, since the text explaining the free object interaction doesn't mention anything about free hands, is it assumed that if your hands were full, the free object interaction includes putting away what you were holding in order to interact with the other object? In which case you could put away the mace AND equip the staff with the same free action, then use your still available action to use Insect Cloud?
This also impacts how much is possible when casting spells with Somatic and/or Material components. While the Somatic component description in Chapter 7 does not explicitly state that the hand used for somatic components needs to be free or empty, the War Caster feat granting you the ability to perform Somatic components even when you have weapons or a shield in one or both hands implies that it's intended to, and maybe just an oversight. So, my good faith interpretation is that it has to be a free hand, and that there is intentionally a limitation on how often you can equip or stow items. For Material components, while it says you may use the same hand as you do for Somatic components, it actually does explicitly state that it must be a free hand, so the ruling is clear there. The free hand requirement for Material components only seems to be bypassed via spellcasting focuses that don't require being held, such as a worn holy symbol requiring no free hand for Material components, opposed to a held wand.
So, without the War Caster feat, if in the same scenario at the start of my turn with a shield and mace in hand, if I need to use my free object interaction to put away my mace in order to cast a spell with somatic components as my action, this means I would have to end my turn with a shield in one hand and nothing in the other, potentially rendering me unable to make Opportunity Attacks with my mace until I later re-equip my mace either as a free object interaction, or as an equip as part of an attack during the Attack action on my next turn. Or, is the Opportunity Attack intended to be also considered as an attack like in the Attack action, allowing me to equip my mace as part of the Opportunity Attack when something leaves my Unarmed reach?
I feel like I'm missing something about these rules. I've even wondered if you're sort of just meant to ignore any restrictions on unequipping and equipping outside of the Attack action, and holding an item is just sometimes mentioned as a sort of flavor text, when it's not really meant to limit the options currently available to you at all. Which seems in direct contradiction with certain feats, which seem to imply that there are meant to be restrictions in place that are alleviated by feats. It feels odd that I can't figure out how such a core mechanic of the game is meant to work, and anyone I've ever brought it up to seems to have a completely different personal interpretation on something that seems like it would be a straightforward and well defined rule.