iFixit sells the replacement part here. It looks like new camera modules are out of stock, but used and fully tested ones are still in stock as of May 15, 2018.
Google Pixel/Pixel XL Rear Camera
A helpful tip: before you re-assemble the phone, shine a bright light through the back glass and check that there is no dust or debris on the inside of the back glass or the camera lens.
Also, this may be obvious to some, but you will need replacement adhesive for the display in order to re-attach it to the phone. I didn’t even think about this until I had already started the repair and taken the display off.