Pixel count in digital photography does matter, and it depends on the image you are creating.
High Resolution Cameras
Most smartphones now have high resolution cameras that are capable of at least 6 MP (megapixels) which is 6 million pixels. When looking at camera specs MP is also something manufacturers advertise. The pixels are “picture elements” which determines the quality and resolution of your photos. The more pixels the > size of the photo, the more quality and detail available for the photographer/retoucher to work with. Less pixels means < size and less detail and quality. The photo undergoes further loss in detail if compressed using a format like JPEG. The image resolution is the full size of the photo measured as Width x Height = MP. When shot in full RAW format, the details are preserved and can be edited in a non-destructive way that keeps the original image but allows for export to a different format for the final edited version.
The pixel count is determined by the digital CMOS sensor in the camera. There are different types and here are some comparisons.
Here are common pixel resolutions from various digital cameras:
iPhone 6 6 MP (2816 x 2112)
Samsung Galaxy S8 12 MP (4200 x 2800)
iPhone XS Max 12 MP (4200 x 2800)
Nikon D7000 16 MP (4928 x 3264)
Canon EOS 5D Mark III 22.3 MP (5760 × 3840)
Sony Alpha A7 II 24.3 MP (6000 x 4000)
Canon EOS 5D Mark IV 30.4 MP (6528 x 4664)
Nikon D810 36.3 MP (7360 x 4912)
The > MP the higher the resolution, the more detail and quality the image contains stored in RAW format. While the overall image quality also depends on the camera lens, sensor, image processing and post production software, pixel count matters most when you need the best quality that your camera can provide.
Pixel count and image quality is not as important when uploading to social media sites like Instagram or FB. Most are shot from smartphones which could be from a camera sensor between 6 MP and 12 MP, which is not bad for viewing on the web. In fact the image is downsized to 1080 x 1080 which Instagram does in order to keep up with high end resolution on devices with retina display and QHD resolutions, though it is not near these resolution in actuality. For commercial photography where images need to have the best quality, more pixels is best. This is because the images are blown up for print as well, to 8.5” x 11” posters and even billboards. Professional quality high resolution images are also used in print publications like magazines and brochures. Higher resolution images will also look their best when seen on high end displays capable of > HD resolutions.
The best way to see how more pixels is better than less, is to put 2 images of different resolutions side by side. Now zoom in on each image, as many times as you like. When you zoom in on high resolution images you can see more finer details, while with lower resolution images the details are lost and the image becomes blurry. The images in my example are different sizes. The image on the left is 3264 x 4928 while the image on the right is 800 x 1208. Notice when the image with less pixels is zoomed there are plenty of artefacts and aliasing on the edges of the image are apparent. That is why it is better to shoot with a high MP DSLR than a low MP smartphone for commercial prints. Otherwise if just to share photos with friends a low MP camera is fine. So, taking good pictures is about composition and lighting basically, not pixel count. A good picture is one that was taken with proper focus, sharpness and exposure. Pixel count is about capturing more detail and quality of the image.