Hey, I can try to help.
Dream Codes started with the 3ds version, New Leaf. However, unlike having the dream suite in a building, when you lay in your own bed, you can have option to just lay there, or I think its 'Sleep' or dream. This will let you create a dream code, that is your town, as it is at that very moment (so if you want to make a special theme for people, you can set it up dream, and then revert things back to normal), or you can enter the dream code of someone else's island and there fore you can see what they have there. Anything you do that island, or is done to yours, will not stay. Same with items grabbed. Because it is a dream it isn't real.
Dodo Codes are for inviting other people to your own island, or visiting others. When you talk to the dodo at the airport, if you want to invite anyone over, who isn't on a friend list, he will give you a code, if you forget it he will remind you when asked. This will open the gate and anyone up to 8 visitors can come to your island if you give them the code. If you want to visit an island, say you want to travel via Dodo Code, and then enter it in. Again the code would have to be provided by the host villager, and is random every time the gate is open and closed again. But there is one think important, you need to have a Nintendo Switch Online account to be able to visit other islands and have others visit yours. Like PlayStation plus, is how you can access any online play with other players.
I hope I have helped, and if there any other questions, feel free to ask, and either I or someone else will respond.