The LM317 (TO-220 package) is a fraction of the price and is more thoroughly stocked and multiple-sourced so there is a very strong incentive to use it where it is appropriate.
For example, right now there are no TO-220 package LM338 parts available from Digikey (only the Pb version is available from factory order) and the noPb version is marked not for new designs).
There are thousands of TO-220 LM317 available made by ST, ON and TI.
The TO-3 versions are more expensive than an entire power supply (for either part).
I'd also be pretty confident that the LM317 will still be available from one or more first-tier suppliers in 5 years at a reasonable price, the LM338 not so much. Linear supplies are an ever-shrinking market, and the remaining legacy linear supplies don't tend to use monolithic regulators at all. At least the LM317 is useful in low-current circuits. But the LM1117 semi-LDO and equivalents are more popular these days.
Both the parts you mention are more than 40 years old, so comparing which is newer than the other doesn't seem very useful.