cryptography – Why mod operation can be used as hash function

I’m new here, and I’m currently trying to understand why mod operation can be used as a hash function.

For example, consider the function $h(x)=xmod 2^{256}$, where $x$ can be a string of any length. The book says that this function will return a fixed size of 256 bits. To my understanding, $h(x)$ will return an integer in the interval $(0,2^{256})$, which can be expressed in 256 bits. My question is that, suppose $x$ is $5$, then $h(x)=5$, which can also be expressed in 3 bits (101). How do we guarantee that the output will be the size of $256$ bits? (I am just new to computer science and apologize if the question is too elementary).