Yes
To play Devil's Advocate here, it is not strictly RAW to disallow spellcasting. Of course, it is a sensible house rule -- but it would be a house rule if you disallowed it.
Jeremy Crawford says you can
This tweet from Jeremy Crawford explicitly states that being underwater doesn't interfere with spellcasting. There is no conditional "Yes, if they can breathe underwater"
JC says you can, but only if you can breathe underwater?
Another tweet from Jeremy Crawford says that, if you can breathe underwater, you can perform the verbal components of spells. Fair enough. However, this is NOT the same as "if you can't breathe underwater, you can't perform the verbal components of spells" either.
Just as saying "if you can sing, you have a voice" is true, but "if you can't sing, you don't have a voice" is not necessarily true. Again, strictly speaking, nothing is disallowing spellcasting here yet.
The PHB says you have to be able to talk?
As @NautArch has shown, the PHB does mention a rule on V components of spells that seems like it should affect spellcasting.
Most spells require the chanting of mystic words. The words themselves aren’t the source of the spell’s power; rather, the particular combination of sounds, with specific pitch and resonance, sets the threads of magic in motion. Thus, a character who is gagged or in an area of silence, such as one created by the silence spell, can’t cast a spell with a verbal component.
This question on Quora asks if we can talk normally underwater. Well, the answer is yes, we can speak normally. The question is just, can the person you're speaking to understand you?
Well, in spellcasting, nobody needs to understand you. You just need to produce mystic words that form a combination of sounds, with a specific pitch and resonance. Note that you can always do this underwater, it's just that the sound is formed in your larynx and becomes distorted as soon as it touches the water. But the rules don't say "the sounds must reach outside your larynx" or "others must hear you clearly". You can technically still do it.
Moreover, every spellcaster will likely have different ways of casting the same spell, just because they naturally have different voices. It is not against the rules to consider that there are multiple ways you can set pitch and resonance, but still cause the weaves of magic to be set in motion in the same way. So, sound can still travel through water. Why can't a magic user speak those mystic words in a way that, when the sound travels underwater, the specific pitch and resonance still matches what is needed to pull off the spell? RAW, this is not illegal.
But Gagged prohibits spellcasting, so why doesn't being underwater?
There are many ways to wave this away. Any answer I give will not be RAW, and is in DM fiat territory absolutely.
Nonetheless, you can argue that when you are gagged, your tongue cannot move about and you cannot shape the sounds and words precisely because of this, whereas being underwater does not forbid this.
You can also say that being gagged restricts your jaw movement, but being underwater doesn't, so you still retain enough control to be able to cast while submerged.
Sensible House Rules
Casting underwater is different from casting in air, this is true. How you handle this is up to you. This Enworld discussion shows a few ways other DMs handle it, in the order of their appearance in that thread:
- Spellcasting is totally disallowed underwater unless the caster can speak underwater
- Allow spellcasting underwater without penalties, as there is no rule actually forbidding it
- Have the caster perform a check. On a failure, the spell slot is not wasted, but the action is lost. But only do this if: 1) there was a way around this issue, or 2) being in the water is intended to be a penalty. Otherwise, just let the casters cast normally.
- If spellcasting is penalized underwater, non-casters must be similarly penalized
- Allow one spell to be cast, but then immediately have the caster start drowning
- Require a concentration check before casting a spell
- Disallow spellcasting for a one-off encounter, but allow it if the characters are expected to be under the water for extended periods
Another definitive JC Tweet:
You can cast a single spell underwater, but afterwards you begin drowning if you can't breathe underwater. Otherwise, no rule prevents verbal components from working underwater. Thanks to @mxyzplk for bringing this tweet to my attention!
Extra Note: In that Twitter thread, Dan Dillon asks:
Is the intent that if you cast a verbal component spell you're no longer holding your breath (and now on Con mod +1 rnds)?
To which Jeremy replies "yes." But technically it is Con mod rounds only, without the +1. The +1 only happens when you've held your breath and have Con mod + 1 minutes before you start drowning.
You will never have to worry about passwall targeting the barrier
Passwall's description states (emphasis mine):
A passage appears at a point of your choice that you can see on a wooden, plaster, or stone surface (such as a wall, a ceiling, or a floor) within range, and lasts for the Duration.
The surface of the Cube of Force creates "a barrier of Invisible force". If the caster cannot see the barrier, typically requiring a spell like See Invisibility, then they cannot target the barrier. But even if they can see it, the barrier isn't wood, plaster, or stone. Thus, it is an invalid target for Passwall as far as a direct cast.
With that in mind, the only thing we need to worry about is the cube's barrier overlapping with an opening, created by Passwall, on a different surface. In that case, Passwall's effect has nothing to do with opening a passage in anything other than the surface it was originally cast on. Thus, we don't have to worry about any effect applying to the cube, aside from the specific description in the cube's text.
The cube loses 1d6 charges because the item's description says it does, but no hole is created in the barrier because the cube didn't say that would happen, and the Passwall spell wasn't cast on the barrier.
Repeatedly colliding with a Wall of Fire will continue to drain charges
The cube's description only states:
The cube loses charges when the barrier is targeted by certain spells or comes into contact with certain spell or magic item effects
The text makes no mention of "The first time the barrier is targeted..." in contrast to many other effects that do use this language. For example Wall of Fire itself, which says:
A creature takes the same damage when it enters the wall for the first time on a turn or ends its turn there.
From this, we can determine that no matter how many times you run into the same Wall of Fire, the cube will continually lose charges, because there is no exception which states that the drain was only meant to be applied one time.
Best Answer
Yes you can, the walls spring into existence, therefore anything within the cube that's is blocked by the walls is simply stuck inside until the cube is deactivated.
Ref. DMG pp159-160