QR codes are actually extremely complex — far, FAR more so than, say, the ISBN barcodes on books or UPC barcodes on grocery store products.
You can in fact decode simpler ones by hand: Decoding small QR codes by hand (or watch a video: https://www.youtube.com/watch?v=KA8hDldvfv0)
(that one spells out someone’s name)
But QR codes can encode much, much more data than that (up to about 3 kilobytes), and they have multiple different versions, encoding schemes, error correction levels, etc.
One that holds more information can look like this:
(From Wikipedia. It is just a message saying how much text QR codes can hold, who invented it, blah blah blah)
If you had a few years, yes, you could still decode that by hand — it’s just a computer algorithm, like any other — but it would be incredibly difficult, tedious, and error-prone.
Here’s a more technical explanation: QR Code Structure: Everything you need to know
Their “error correction” system alone is quite advanced, with a lot of built-in error checking and redundancy so that even if the code is scratched, or your camera doesn’t take the best photo of it, etc., it can often still be salvaged. Here’s a cool visualization of how the error handling works: https://qris.cool/
The red squares are areas that I mutilated beyond use, but even with those, the QR code as a whole still scans.
All this complexity means that there is always room for security issues. Although rare, they CAN happen… they are a data payload, like any other, and sometimes buggy software can scan a malicious QR code and execute code, as in ZBar Heap-based Buffer Overflow Vulnerability - HackMD (aka CVE-2023-40889 in the US gov-associated software vulnerability database).
There is no one single QR code scanner software either, so different vulnerabilities/malicious codes may affect each one differently. Google has their own (built into the camera app in recent versions of Android), Apple has their own, Samsung has their own, there are a ton of third-party ones on the app store, etc.
There is no real way you can guarantee the safety of a QR code you scan, with a particular phone you have, because there are too many possible permutations. If you really want to be safe, get an old burner phone, take out its SIM, put it on permanent airplane mode, and use that to scan QR codes if you want to.
Or just ignore them ask for a regular URL instead, and only follow that if you trust the domain.
Real-world attacks with QR codes are very very rare, but if you are paranoid… the possibility is there.