Welcome to TRS
No, the 2004 Explorer used a Borg Warner BW4410 or BW4411 transfer case and its mounting to the transmission looks much different that the M5OD-R1 manual 4x4 trans mounting
Rangers used the BW1354 transfer case
BW4410 transfer case, transmission mount:
https://i.ytimg.com/vi/vxqovtIt02Q/maxresdefault.jpg
Not round
M5OD-R1 4x4 manual trans transfer case mount:
https://www.therangerstation.com/wp-content/uploads/2017/06/m50D-R1HD.jpg
Round
The M5OD-R1(M5R1) is the manual trans used in Rangers from 1990-2011 with the 4.0l engines, OHV or SOHC
You might be able to swap in the M5R1 with BW1354, but "might" is the key word, would need to be 2001 and up
But in any case there will be issues with your engine computer(PCM) as its setup to "see" an automatic transmission, and there was no manual transmission option so you would need to spend some money on reprogramming
Also if there is any kind of traction control features they would most likely need to be modified
Also a clutch pedal setup would need to be figured out, as there wouldn't be an "off the shelf" version available
I would ask over at Explorer forums, they will know more about a 2004 Explorer conversion to manual transmission
Explorers stopped sharing Ranger parts in 2002 and up