In most cases, yes they can.
This includes output devices, usually in TO-3 packages, through to tiny little TO-92 devices, and everything in between. The art lies in understanding how to substitute transistors and which parts are appropriate to use in place of the original older types. I won’t be giving too much of that away!
It gets trickier when we consider certain MOSFETs and VFETs. Some of these are no longer available, nor are there suitable replacements. That being said, I’ve just repaired an amplifier with blown TO-3 MOSFETs and I used new, replacement parts from stock in that case, which worked perfectly.
Most older devices have modern replacements and I have a database of cross-references that allows me to match new devices with dead old ones. I keep hundreds of transistors in stock, including high-spec modern replacements for many vintage types including TO-39 and TO-66 types that are no longer available.