iPhone XS Random Hard Reset
Replaced hardware (iPhone) has the same problem as the previous one.

That's is rare or improbable.

The chance are it is some malfunctioning app, that cripples the IOS.

Do not use restore (for now), use fresh install (clean install) to test for few days.

If nothing worked, take it back to the store.