The newer Thin series iMacs are very hard to open without the correct tools and skills. I would strongly recommend not trying.
As to using a Samsung SSD unit: Apple uses a blade style SSD that is similar to the M.2 SSD standard. They use their own firmware so even getting the correct Samsung PCIe SSD unit you still won't have a working setup. So far Apple does not sell the custom SSD units and the only option is finding a used Apple SSD unit on eBay. Sadly, many are not real Apple units and will not work. Here's the IFIXIT guide on have to replace it: iMac Intel 21.5" EMC 2805 SSD Replacement. The guide was written with the idea it would be possible (which we currently know it is not).
As to upgrading the RAM: Apple is now soldering the RAM directly on the logic board so you can't upgrade the newer 21.5" iMac's which have only 8GB of RAM. The older iMac 21.5" models did have RAM sockets but it was still a bear to get to them.
Mayer's link above is what is involved in the older models. Here's the IFIXIT Guide on replacing the complete logic board: iMac Intel 21.5" EMC 2805 Logic Board Replacement. Which is the only means to upgrade a base model. If you look at Step 65 just to the left of the CPU chip (green chip) you will see the four soldered chips.
Here's the rundown on which A1418 model has removable RAM:
- The base model is only available with 8 GB soldered RAM
- Mid and high-end models are configurable to 16 GB at time of purchase. It should be noted the 2.7 and 2.9GHz models can be upgraded, but the machine needs to be tore down completely.