Soon after the first batch of Pixel 5 units started making their way into the hands of customers, reports started popping up of users seeing a gap between display and body. This led to concerns about the phone's water-resistance being compromised as the gap could allow for dust and water ingress. Google has investigated the matter and as per a "Community Specialist," the "clearance between the body and the display is a normal part" of the Pixel 5's design.
Google also confirmed that the gap will not have any effect on the dust- and water-resistance of the Pixel 5 as well. Below is the entire post made by a Google "Community Specialist" David Pop on its support forums.
We’ve had a chance to investigate units from customers and, combined with our quality control data from the factory, we can confirm that the variation in the clearance between the body and the display is a normal part of the design of your Pixel 5. There is no effect on the water and dust resistance or functionality of your phone. We will work with customers on an individual basis to address any concerns they may have.
Some customers had managed to get their Pixel 5 units replaced by Google for this issue. However, now that Google has investigated the issue and deemed that it is a "normal part of the design," the company is unlikely to issue replacement units for the same any more. If you are still bothered by the gap between the display and body of your Pixel 5 though, do make sure to contact Google.
Source: Google Support