Code 31 is usually a bad EGR sensor, usually.
To test if it is the EGR valve or the sensor get a length of vacuum hose that will fit the EGR valve's vacuum port.
EGR valve should only open when engine is under a load, i.e. driving up a hill or accelerating hard, so when engine is idling there should be no vacuum on it's hose.
Start engine and let it idle
Remove EGR valve vacuum hose and feel the end of the hose for vacuum there should be no sucking(vacuum) on that hose.
Now put your vacuum hose on the EGR valve and suck on it, no you won't get exhaust smoke in your mouth.
Engine should start to stumble and if you hold the vacuum long enough it may even die.
Release the vacuum, stop sucking, and idle should return to normal.
If this happens then EGR valve is good and sensor is bad, replace it.
If this doesn't happen remove EGR Valve and clean it, retest, if same results replace EGR Valve.
There is no "10" code, generally "0's" were skipped on OBDI because how do you code "0" with flashes?
So 10, 20, 30, 40, ect..........are either not used at all or are specific to an engine and model, none of which are Rangers