I agree with @hawkins24 that you are going to need to replace the screen. Even if there isn't any visible damage, there are delicate connections between the flex cable that goes to the motherboard and the glass that the display circuitry is printed on. It sounds like a section of those connections has come loose and unfortunately there's no way to repair them so the only cure is to replace the screen as Hawkins24 advised.
The repair on your phone is pretty straight-forward; basically you just have to separate the screen from the chassis then glue a replacement back on; that's really about it. Well, there's a speaker you have to take off the old screen and move over, but that's all. Here is iFixit's guide to that repair.
Google Pixel 5 Screen Replacement - iFixit Repair Guide
You can buy a genuine Google replacement screen right here on iFixit, which guarantees you a top quality screen, a lifetime warranty and you support iFixit's repair efforts.
Pixel 5 Screen: Genuine Part / Replacement Kit - iFixit
For an extra $7 USD you can get the Fix Kit version that includes all the tools and adhesives needed to complete the job; pretty good deal, all in all. Of course, for the budget minded you can also pick up cheaper aftermarket versions on sites like Amazon, eBay and AliExpress, among others.