The 4.0L V6 Explorers came standard with 3.27 gears but there was the option for 3.73s. Mine came with the tow package which included the LSD and 3.73 gears. Ford didn't offer a 4.xx gear for the Explorers.
If I were you I would pull the cover off and check out the condition of the gears and bearings before installing it on the Ranger. While you have the cover off you can check to ratio. What does your friends Ranger have done to it? What size tires is he going to run? Is it an auto or manual trans?
I ran my Explorer with 31s and the 3.73s but I wished that I had 4.10s. When I went to the 33s I changed to 4.56s. I use to have a 91 Ranger 2wd prerunner with a 4 inch lift, 31s and 3.73s and they were perfect for that truck. It had a full fiberglass frontend and rear bed sides so it was lighter than my Explorer. Plus it had full exhaust and a chip so it made more power as well. Man I miss that truck. I sold it to my nephew Eric and he eventually totaled it. Here are some pictures of it after Eric bought it.