I have merged two photos into a panorama (Photoshop). The original photos are fine; but in the final merged photo, the buildings on the right side of the photo are visibly distorted (stretched). Why did Photoshop do that and is it due to the format that it is trying to fit the photo to? I don't care about the photo format as much as adhering to the non-distorted photo that was taken.
This kind of distortion is typical for wide-angle photographs in rectilinear projections, and panorama software usually creates those by default (since that mimics what a wide-angle lens would usually do) unless told otherwise and/or impossible (a total view angle of 180° or greater is not possible to cover rectilinearly). A rectilinear projection has the advantage that straight lines remain straight lines: that is often desirable for buildings and architecture. A cylindrical projection does not suffer from this kind of distortion at the border but it does not retain straight lines: you get more of a "fisheye" effect.
Most panorama software offers a selection of projections to use for the final result, with differing consequences and compromises.