The Engine Control Unit (ECU) on a 2002 Ford Ranger 2.5L TD (diesel) is typically located
under the hood, near the firewall, on the passenger side. However, its exact position can vary slightly depending on the specific trim level and options. It's usually a fairly large, black, rectangular box with various connectors.
You'll likely need to look carefully near the battery and other components in that general area. A repair manual specific to your vehicle's year and model will provide the most accurate location.