I have a 2010 Ford Ranger 4x4 diesel manual that’s done 230,000 km, and less than 500 km in 4WD. For the last 20,000 km the gearbox has been difficult to engage in first, second and reverse. Even when stationary it's often clashing gears to engage. I've changed the oil with no difference. Also, since it was new or very early on when I got it, at about 120,000 km the gearbox was jumping out of first gear in both 2WD and 4WD going downhill (using gearbox not brakes).
Have you checked the clutch? It could be worn out at that sort of mileage. If that’s ok get the adjustment of the selector checked.