If I got it right, you just took a picture and did not try to decode the QR code. Your phone safety should remain intact: you are just storing a new picture in your gallery.
However, the QR code likely contains data, and you don't know what that data is. Maybe it is a link to a website to buy illegal drugs, so it is a good idea to delete the picture as you did. Be careful the picture may have been uploaded to some server or cloud service before you deleted it, depending on your phone configuration. At that point, a company (Google, Apple...) may know you had that picture in your hands.
Decoding the QR code would have been more risky. A QR code is just a small set of binary data. Problems come when the app you use to read it tries to interpret the data and make something of it. Therefore, potential damages are very app-dependent. Some examples:
The app tries to convert the binary data into a string and if it is a URL, opens your browser to follow the link without warning. If this is a link to process a payment and you are already connected in your browser on an account such as Paypal, you might send money to an unknown account.
Obviously, trying to read with a payment app a QR code from sources that are not trusted is not recommended.
Big QR codes can technically store binary compressed data. I don't know if such apps already exist, but if your app tries to unzip the data, you may be vulnerable to zip bombs.