There is a correct range of values, however it is difficult to describe exactly what that range is. Generally, 10k works.
Digital outputs have a specified ability to source or sink current. If your output could sink 5 mA and the output was connected through a pull-up to 5 V and then set to 0, you would need a minimum of 1k resistance. If you use less than 1k, the output will not be able to sink enough current to pull the pin all the way down to 0V. If you use a bigger value, like 10k, then the pin only has to sink 0.5 mA, which is much less than it's rating.
Digital inputs have a specified leakage current. This is kinda like the amount of current it takes to "maintain" a 0 or 1 at an input. If your pull-up resistor is too large, then it won't be able to overcome the leakage current. If it just barely overcomes the leakage current, then any noise in the circuit could be enough to change the input.
When using digital outputs that can sink and source current ("totem pole driver", "push-pull driver"), you might be tempted to not use pull-up or pull-down resistors. However, it is very important that CMOS inputs not be allowed to float or they can pull excessive current...and it's very easy to forget that bidirectional MCU pins usually come up as inputs!
I2C and other protocols like it use "open drain" (or "open collector") outputs. Instead of having outputs that can pull up and down, and open drain outputs can only pull down. That is why the external pull-up resistor is required. There are now additional restrictions on the range of pull-up resistors; the pull-up value will form an RC circuit with the bus capacitance. Too small of a value will once again prevent the output drivers from sinking enough current to pull the pin all the way down to 0. However, too large a value will take too long to charge the bus capacitance up.
If there are setup/hold times that you are not allowed to violate, those will help you determine an RC time constant. The bus capacitance is largely determined by PCB layout, so you can then pick an R value that combines with the C to provide a value that is comfortably within the setup/hold time for your digital input.