In the Forgotten Realms setting, can gods freely travel between dimensions or planes of existence? I don't think they can, or there would be chaos. But maybe a powerful god like Bahamut or an Overgod like AO could?
From Faiths and Avatars. (ADnD source, but unfortunately there are very few in depth 5th edition info on gods)
Under the abilities list of Greater Powers
Planar Travel: Just as they can teleport across space without error, so too can they travel between the various planes of existence at will. These powerful beings cannot, however, travel to the Prime Material Plane.
Although Lord Ao banished the gods to the material plane during the time of trouble, it appears it is the only plane barred to them now.
When it comes to the prime material plane, they are limited to avatars.
When powers have vital business upon the Prime Material Plane, they must send avatars to act for them. An avatar is simply a manifestation of a deity upon the Prime Material Plane. This manifestation is not nearly as power- ful as a power and is merely a projection of a deity’s power to the Prime Ma- terial Plane. An almost infinitely vast gulf of power lies between the god and the avatar.
Finally, it must be noted that extreme circumstances can allow gods to travel to the prime material plane. Tiamat can successfully return to the material plane with use of her dragon cult, and does so if the heroes fail in the 5th edition adventure Rise of Tiamat.
Outside of Forgotten Realms
Though somewhat little info is available in 5th edition outside of the Forgotten Realms (as it is the official setting). The Theros campaign setting features and details gods greater than most. A few important things of note from here
The god Kruphix is able to confine them to Nyx, preventing any direct interaction between the gods and the mortal world.
So at least one god is able to force others to certain planes.
But just as importantly is
Gods grant their clerics the ability to cast spells, and they can effortlessly duplicate the effect of any spell they could grant (any spell on the cleric spell list, as well as any domain spell from their domains).
Further, the gods of Theros aren’t omnipotent. Although they are physically and magically powerful, ageless, and all but indestructible, their actions are bound by the decrees of Klothys.