Here's a good source of info on your system 2019 21.5" Core i3 3.6GHz iMac (4K).
This model has a Serial ATA (6 Gb/s) connector for a 2.5" hard drive. If configured with a "Fusion" Drive or an SSD at the initial time of system purchase, it also has a PCIe connector, but this connector is not present if the system only is configured with a hard drive.
So depending on your exact system it may not be populated with the custom Apple PCIe/NVMe blade SSD connection. Sadly you can't use the M2. SSD's made by Crucial as Apples is different. If present, here's the part info iMac Intel 21.5" (Mid 2017-2019, Select Models) Blade SSD Upgrade Bundle and here's the guide to put it in iMac Intel 21.5" Retina 4K Display (2017) Blade SSD Replacement while this is for the 2117 model its the same procedure and uses the same blade SSD drive. Otherwise you'll need to go with the iMac Intel 21.5" Retina 4K Display 2019 Hard Drive Replacement using a 2.5" SATA SSD.
Here's the needed RAM kit iMac Intel 21.5" EMC 3195 (2019, 4K Display) Memory Maxxer RAM Upgrade Kit to boost your system to 64GB (60-pin) DDR4 SO-DIMMs - PC4-19200 2400 MHz (for Core i3 system) or PC4-21300 2666 MHz (for Core i5/i7 systems) and here's the guide iMac Intel 21.5" Retina 4K Display 2019 RAM Replacement