The guts of M5ODR-1 transmission
4th is direct drive aka 1:1, no gears involved. - we can ignore it from here on.
All M5ODR-1 transmissions have 23 tooth (I'm going to abbreviate that as 23T) input gear.
All M5ODR-1 transmissions have 52T/23T 5th gears
4.0 transmission has counter shaft with 38T---34T-25T-17T, Input, 3rd, 2nd, Reverse and 1st combo respectively. (Extra dash is space for 4th)
non-4.0 transmission has counter shaft with 38T---32T-24T-16T, same order as 4.0
Note: The gears are machined into the countershaft - no pulling them off to mix and match.
4.0 (staying in order in transmission) 3rd 27T; 2nd - 31T; 1st - 35T (I'll ignore Reverse)
non-4.0 (staying in order in transmission) 3rd 29T; 2nd - 32T; 1st - 36T
Note 2: There is additional countershaft for reverse
Maybe easier to visualize in a table:
4.0 | Input | | 4th | 3rd | 2nd | 1st/Reverse | 5th |
Input | 23 | Output | - | 27 | 31 | 35 | 23 |
Counter shaft | 38 | | - | 34 | 25 | 17 | 52 |
| | | | | | | |
non 4.0 | | | | | | | |
Input | 23 | Output | - | 29 | 32 | 36 | 23 |
Counter shaft | 30 | | - | 32 | 24 | 16 | 52 |
Once upon a time,
@Shran asked where I came up with my ratios and why they didn't match Ford brochure - well, I counted teeth on the gears and did the math. 38/23 * 36/16 = 3.72 for 1st in non 4.0 while 38/23 * 35/17 gives 3.40 in 4.0, similar for rest of ratios. If you put 31T 2nd gear from 4.0 transmission with 24T main shaft from non 4.0 transmission, the teeth on the gears would barely engage and very quickly break.

So, it is all or nothing swap.
I can't say if all inputs will work with all countershafts as I haven't tested, I've always swapped matched shafts (gears tend to be happiest when matching pairs, so I have always swapped inputs as well as counter shafts and gears.) And I can't tell you if Mazda used better steel in 4.0 HD transmission (We will note the 4.0 input shaft had a different part number). So, I can't tell you if the non-4.0 really has the strength in 1st behind 4.0 or not.
The old helical gear transfer cases (Dana 18, 20, 24, 300 & NP 203, 205) could be shifted from low to high like you would shift a crash box - shift out of low into neutral, match revs and shift into high (NP203 is easiest as range is really 2 spd. crash box; Dana 18 isn't bad as you're only moving 1 gear, the others are tricky as the linkage is...sloppy, better when they are set up for twin sticks). The newer transfer cases with their planetary gears e.g. BW1354 in Ranger, are next to impossible to manually shift due to design of teeth on shaft; electronic transfer cases have a "nanny" to prevent shifting if in gear/going more than 5 mph/8 km/h.