LM338 replaces LM317

I want to use lm338 instead of lm317 in the picture below, can I use another one with a higher power?
There are pcb diagrams and schematic diagrams I wonder if this circuit can be replaced with lm338. A simpler lm338 circuit is provided. You can modify this circuit as much as possible.

You need two protection diodes for the LM338.

What are you expecting from that ancient linear supply.
Those circuits have severe thermal limitations, even with huge heatsinks.
You can't draw much more than about 500mA at 5volt out without cooking a TO-220 chip.

You could keep the LM317 and increase current handling capacity by using a big TO-3 BJT. Several examples available online.

But I have to agree with @Wawa. Why bother optimizing this 1980s solution? For the cost of an LM338 you can just about get a buck converter that offers superior performance - especially if you take some additional noise suppression measures (if needed).

Depends what you need - if the ability to vary the voltage with an external potentiometer is required, it may makes sense. If you also need no switching noise, even more so.

If you just need a given voltage at several amps perhaps a simple LM3596 preset-adjustable buck converter module is workable?