There are major differences between the '87 and '93 motors: There were also two 4.0 motors used in the '93; one of them will bolt up to the '87 transmission; but the other will not.
The 4.0 exhaust manifold is shaped differently from the 4.2 manifold; so at least the exhaust head pipe, and maybe more exhaust parts would have to be changed.
The computers are totally different and would have to be swapped; but there were two different computers used on 4.0 manual transmission vehicles in 1993; so you'd need to find the right computer to use with the motor you get.
You would also have to change the underhood and under dash wiring harnesses to mate with the motor and with the computer. The '93 wiring harness may not match the '87 instrument panel or switches; and it may not match the feed through on the firewall.
The '87 vehicle used a low pressure mechanical fuel pump mounted on the motor; while the '93 vehicle used a high pressure electric pump located inside the fuel tank. You would either have to adapt a '93 fuel tank and pump assembly; or use a high pressure in line electric pump that properly matched the '93 engine's fuel pressure requirement (which may be impossible to find). You would also need to add a fuel pump relay and a tip over switch to operate the electric pump.
The two motors use the same motor mounts. The throttle linkage may need to be changed.
The differences in the computers, fuel pump, and wiring harness are enough to make this swap a potential nightmare. Unless you are experienced in electronics and resourceful enough to deal with those issues; I would suggest you not get into this project.