Photoshop CS and later can work with documents up to 300,000 pixels in each dimension, but it's limited by RAM and when saving a document you have filesize limits due to the bit depth of the headers:
PSD = 2GB
PSB = 4GB
Tiff = 4GB
A Tiff file can in theory contain an image with a 4 billion pixel canvas dimension, but in practice it would exceed the filesize.