I have a Nexus 5x. I damaged the camera by dropping the phone. It still worked, but there were black spots on my pictures. Then I figured hey, I'll just DIY the fix. There are YouTube videos all over the place and parts available via Amazon and other places.
So I ordered a camera that had my phone model listed as compatible. I also ordered a $20 tool kit for phone repair because I figured it would be worth it in the long run. I got the toolkit and the camera. Turns out the camera was simply the wrong part. It didn't even fit or have the same form factor as the camera it replaced. It would have cost almost as much to ship it back as it had to purchase it. And taking apart a Nexus 5x feels like breaking it at first -- the back cover is difficult to get off. I didn't break it, but was afraid I would.
So I went to a second site and made absolutely sure the next camera I ordered was the right part, listed as compatible for the exact phone I have. Got the camera, then said hey, now I know how to take the phone apart, so this should go more quickly than the first time. It did. The new camera fit fine, but when I turned the phone back on, it went into a bootloop and wouldn't come out. Tried a couple of more times, putting the new camera in extremely carefully, with the same results. Replaced the second new camera with the old, damaged camera and guess what, the phone turned on fine.
I gave up and took my camera to a cell phone repair store. I tried the DIY route twice, and it didn't work for me. The repair store ordered a camera and when they did the work, everything was hunky-dory.
Sometimes DIY works out, sometimes it doesn't. But at least I have a toolkit I can use when I need tools for a small device.