It would work if you could get them secured together. The double thickness wall where they meet will tend to keep the two devices farther apart then they should be, but there is enough adjustment to make it work. It would be a lot easier to just get a two gang box
There are, or at least there used to be, metal boxes whose sides come off. If you wanted to join two together, you could take one side off of each and then they could be joined and be the right width. (If you wanted to join 3 together, you'd take both sides off the one in the middle.)
But the one you have in the picture is not like that. And I am not sure they still sell them. (Plastic boxes are legal in Maryland, and they have them in two and three width sizes. If I lived where only metal was legal, they probably would sell what I described.) If you are buying your parts locally, I'm sure your hardware store or electrical supplier can find you something that is two-gang, the right width for your plans.
If you are buying by mail or internet, you're right to be careful and plan carefully.
HomeOwnersHub website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.