3.0l trans won't work with either 4.0l or 5.0l, only another 3.0l Vulcan engine, won't physically bolt up, so swap is the same for either, engine/trans and computer with wiring harness.
Since you can go out and buy a 4.0l Ranger swapping in a 4.0l doesn't make alot of sense.
Selling the 3.0l Ranger and using that money to buy a 4.0l Ranger is much cheaper and less work.
4.6l is much wider(29") and taller(28") than 5.0l(19"w x 21"tall) or even a 351w V8 so wouldn't fit in Ranger engine bay without extreme modification.
5.0l swap can be worthwhile since you can't buy one, well if you look around you can often find them for sale and that is often cheaper than doing it yourself.
But if you plan on keeping it a long time then the 5.0l swap can be a labor of love.
Because of your year, 2005, you will run into a few electronic issues, and may need to swap out the dash and wiring as well, the computer runs most gauges and when you change computers..................there in lies the problem with the later models.
Good read here on what is needed to start with: MudSlanger's Explorer 5.0 Swap In A 2000 Ford Ranger
There are always year specific issues that can't be dealt with until encountered.
If you have emissions testing in your area then that adds a complication as well, when changing engine size it needs to be same year or newer engine, and it must meet that years emission levels, you often also end up with a title change, "rebuilt" or "salvage" to denote changes were made and VIN no longer matches, VIN has engine size in it.