I suppose this is a bit of a summary, but what I've found when shooting architecture with an UW focal length, the following helps if you want to eliminate perspective distortion:
1. Make sure the camera is horizontal - not pointing up or down. Use the level tool (or an actual level if you are using a tripod) if that helps you.
2. Make sure that you are also pointing straight at the front of the building or back wall. Not skewed left-to right. This avoids horizontal stretching at one side or another of the image. This rule, plus the above rule, means that you want the axis of the lens perpendicular to the building/back wall.
3. If you can't quite get (2) correct, move yourself left or right a bit. Even a small movement can make a big difference.
4. This all adds up to the possibility that you have to shoot wider than you originally thought & then crop in post.
5. Finally, don't be afraid to play with the amount of lens-specific optical distortion applied in post. While this is unlikely to help with architecture, it can help with big rock formations & things like that, as it can effectively open up the field-of-view that you may have lost when cropping, and the effects can be hard to detect when the subject is more organic in nature.
You can of course "embrace the distortion" if you want, but even then (particularly then, actually) I prefer to center myself left-to-right in most situations.
As an example, I spent some time recently trying to capture the graceful lines of the Colorado Riverway Bridge (which is a pedestrian/cycling bridge) in Moab, Utah. It was tricky.
First example is just ugly. Clearly, the camera is twisted on it's axis (not level) which is super-obvious when you look at the steel members in the lower left & right of the image, but also the arches of said members as they curve away from you:
View attachment 6612
The second is better, but I'm not precisely centered. This was literally a matter of inches.
View attachment 6611
This next shot is pretty good, but still not perfect.. Took my time on getting the lens axis level and straight. When composing, I was looking at the steel members in the FG in the lower left and right in the frame, trying to get them to look the same. This really let me see if I needed to do any small adjustments before I fired the trigger.
I could spend hours photographing this bridge, shooting it from various angles, watching the conditions change, etc. I actually went back three times on different days during our week-long trip to Moab.
View attachment 6613