My last phone, LG Nexus 5X, couldn't do this. My current phone, Unihertz Jelly 2, also can't do this. Guess I have to buy the "premium" brand Androids for this feature.
You're not missing out. My moto g power (2020) can sometimes manage the feature, but only sometimes. Sometimes it just won't scan with the regular camera and you've got to open a dedicated qr scanner... So you're really better off starting with the dedicated qr scanner... except I have a button on the home screen for the camera and have to dig for the dedicated app.
I have the same model - amazing phone for the price btw. - and have the same intermittent issue. But, I can switch to Lens which will always work - just not as seamlessly.
The Nexus 5X is nearly 7 years old at this point and from a quick Google the Unihertz is advertising the fact that it runs Android 10 (released in 2019) so it's probably to do with the out of date software.
I'm surprised that there isn't the option to jump to the built-in qr code scanner (buried in the Tools app, and not accessible directly) for the custom-button on the Jelly2.