Below you can see the front-view size comparison of the Nikon D3500 and Canon M5. The Canon M5 is clearly the smaller of the two cameras. Its body is 8 mm narrower, 8 mm shorter and 9 mm thinner than the Nikon D3500.
The chart below depicts how two cameras compare with average dimensions of the cameras in their class.