SHA-256 is¹ a cryptographic hash function. As such, it has preimage resistance: given a hash value, there is no way to find a string with that hash, except by trying all strings until you find one that works. Therefore you'll have to try all possible inputs, i.e. all strings that contain the known substring. (You can of course be smart about it: try the most likely strings first, if there's such a thing as most likely in your scenario.)
If you do find a string, you can be confident that it's the right one. Cryptographic hash functions also have the collision resistance property: it is infeasible (i.e. practically impossible) to find distinct strings with the same hash. There is no way to find another string with the same hash, of length N or otherwise.
¹ As far as anybody knows, or at least anybody who speaks publicly on the topic.