RAW No, flanking's only conditions are explicitly related to physical position
When a creature and at least one of its allies are adjacent to an enemy and on
opposite sides or corners of the enemy's space, they flank that enemy...
So, RAW say it has to be adjacent. No other conditions are listed besides position.
Defining Adjacent
Adjacent is not defined anywhere in the game as a game term, but it is used a lot. All the instances I have found of the term adjacent definitely imply only one meaning: that two things are immediately next to each other. For example:
On describing the rules for counting ranges on a grid the PHB says:
Ranges. To determine the range on a grid between two things—whether creatures or objects—start counting squares from a square adjacent to one of them and stop counting in the space of the other one. Count by the shortest route.
The word adjacent here clearly only makes sense when read as "the square physically right next to".
I cannot find a single example in any of the rule books where the word adjacent was used to indicate anything other than immediate physical proximity to another thing so it would be incredibly dubious to try to read it that way here.
Similar discussion from designer and possible intent
Jeremy Crawford also touched on this subject:
Q: Polearm Master fluff say you can keep your enemies at bay with reach weapons is not really true if attack is when adjacent
A: On the grid, the target is adjacent if you're using a quarterstaff,
but 5 feet away with the [Polearm Master reach] weapons.
In this example, Jeremy reinforces the idea that "adjacent" is "immediately next to". Not only that, but note that he says that someone 5ft away from a reach weapon is 5 feet away. The strong implication being that they are not considered adjacent.
Conclusion
Bringing this back to flanking specifically, the rules do not even hint at reach being a factor. It doesn't even say you have to be able to make attacks. Just allies adjacent to an enemy on opposite sides or corners.
When dealing with Medium creatures, yes, it might read more easily to say "both". The "each of them" becomes important when dealing with Large or bigger creatures, which take up so much space that multiple creatures can fit side by side on one end.
The rule, from the viewpoint of the attacker, is basically:
- Am I adjacent to an enemy?
- Is at least one of my allies also adjacent to the creature on the opposite end?
If yes, you have flanking.
For an example of when the "each" comes into play, see below diagram of three Allies flanking a Giant. In this situation, all three Allies attack with advantage due to flanking, because "Am I adjacent to an enemy and is there an ally adjacent on the opposite of the creature" is true for all three.
A A
G G
G G
A
On the other hand, in this situation, that doesn't work.
A
G G A
G G
A
While the top and bottom attacker have advantage due to flanking, the one on the right does not.
Best Answer
By RAW: No, it wouldn't help with flanking.
The flanking rules require that two creatures (specifically allies) are on opposite sides of the creature they flank.
However, a spiritual weapon does not count as a creature or an ally of any other creature, it is simply a floating weapon. It does not occupy space and cannot be attacked.
Additionally, it was confirmed by Jeremy Crawford that Spiritual Weapon does not count as another enemy for sneak attack, which is nearly the same condition.
While many DMs may quite reasonably rule that a floating, spectral weapon would be a sufficient condition to provide advantage, by RAW it does not.