Depends on what you want to do. The NP242 has a Full-Time 4WD option that isn't on the NP231 (it's not AWD, but it's close enough for government work,) and has, as I recall, six planetary gears in the input gearset, as opposed to three for the NP231.
They are physically interchangeable - although it's a bit more work than you would prefer. I've exchanged the driveshafts (I have both - four rigs...) before, and I believe you'll have to change the shiftgate and/or shift linkage as well - but I can't swear to it.
The only real problems I see with both of them is the fact that the front output is driven by a chain (rather than direct gear drive,) and the chain will start to stretch, given time. However, the chain in both units seems to last anywhere between 200K and 500Kmiles, depending upon use and wear.
5-90