Some laptops have a smaller space for the SSD (or HDD), and I believe it is 7mm. I've seen some drives advertised as "laptop SSD" in this size, and most come with a spacer to get them to 9mm if needed. Most SSDs are 9mms in thickness. You'll just have to look at the detailed specs of your laptop, or see what's currently installed.
Also, there is no Samsung 870. Maybe you meant the 970 EVO? If so, that's a NVMe drive which is installed in a M.2 slot, and is different (and much faster) than a SATA SSD. However, they run hotter and use more energy, so they're not the best choice for most people with laptops (unless you need that speed for things like video editing or professional work).