My favourite apps for correcting perspective distortion is Snapseed.
Inside the app, go to Tools then Perspective. At the bottom of the screen, you have three icons. The Perspective icon reveals and hides the four tools available: Tilt, Rotate, Scale and Free. As you tap each of these options, an icon appears in the middle of your photo to confirm the mode you selected. How cool are they? Now, tap on Tilt again to reveal the two arrow icons in the middle of your photo.
The second icon at the bottom is the Fill mode that will become clearer when we start playing with this tool. The three options here are Smart, White and Black. Tap on Smart. The third icon at the bottom is Autocorrect. Don't bother with that one!
Next, place your finger on the photo preview and swipe up and down. The grid overlay now has more lines to help you align elements in the photo with a straight line. This is very helpful for straight poles of edges of buildings! The photo stretches to make either the top or bottom of the photo narrow. This counteracts the tapering that occurred at the original capture. The third thing that happens here is even cooler, it magically creates and fills in areas that are not there! It is a process called 'content-aware fill.' It looks at the existing content inside the edges of the frame and fills in the missing bits. So cool!! Don't forget to tap on the tick to confirm you want to apply this adjustment.
Now, swipe left and right to see how you can either correct angle perspective on a horizontal axis. I normally use this for a creative effect than a corrective technique.
Another very effective app for fixing perspective is Adobe Lightroom mobile. One of the few additional tools available on a subscription plan is the Geometry tool. The guided tool allows you to place reference vertical and horizontal lines in your photo. The software will then warp the photo to change the vertical and horizontal perspectives.