A microcontroller's pin when in digital input mode is usually many hundreds of kilo-Ohms or even a few megaohms. They are essentially op-amp (CMOS nowadays) high impedance inputs.
The problem when a pin is set to output is that the output drivers are often quite low resistance - tens of ohms or less. They can burn out if shorted to VCC or GND, depending on the state. It seems you are most worried about this situation, with a button/switch interface.
The standard way to do a switch for a digital input is to put the switch on the low side with a high value resistor externally Like this:

simulate this circuit – Schematic created using CircuitLab
The resistor R1 helps in two ways - if the microcontroller somehow accidentally turns it's pin into an "output" mode, and goes active LOW, this resistor ensures there is no short circuit to GROUND through the pin. When a digital pin goes active low, it's basically a short to ground which is very bad for a pin which is connected to a high power/current capable source.
The second function of R1 is when the button is pressed, it prevents high current flowing through and destroying the switch.
You can't really use the internal pull up resistors in the microcontroller for this set up because if R1 doesn't exist, the switch will fail from short circuit current through it.
The only annoying thing about this whole set up is that it is "active low", as in, the logic value when the button is pressed is "LOW", and when the button is not being pressed, it sits at "HIGH".
Your other option is for the switch to be on the high side, connecting VCC to the digital pin. You can then use internal(very rare) or external pull-down resistors. This is good because the switch can't be externally grounded, but can still have problems if you had the microcontroller pin accidentally set to output and had it set to LOW (which is an almost direct connection to Ground as I mentioned earlier).

simulate this circuit
To explain the above diagram, Rext is the location of an external resistor if you decided to do this. This ensures when the button is not pressed, the digital input node voltage will decay to zero through this resistor. The Rint is the possible internal resistor if your microcontroller provides one - these are often in the range of 20-40k Ohms. In case of setting the pin to OUTPUT and LOW, the Rprot is there to serve as a short-circuit protection resistor - honestly all general purpose microcontroller pins should be given an external series resistor like this, to make them more rugged.
I myself use the first diagram, with R1 between the pin and the switch, to VCC. This covers all bases and protects against crazy things. I just accommodate the logic level being LOW when active in my software.