Microcontroller Unused pins Configuration
Setup your unused pins as outputs. You can choose if the output level is selected as high or low.
But if you happen to enable the internal pullup resistor you want to set the output level to a high so that the output driver is not pulling current through the pullup resistor.
Likewise if you happen to enable an internal pulldown resistor (if your MCU supports that) you want to set the output level to a low so that the output driver is not sourcing current to the pulldown resistor.

Some folks prefer to set unused pins to digital mode as inputs and shut off the output driver. In this case you want to enable the pullup resistor (or the pulldown if supported) to ensure that the input is held stable at a high or low level.

Which is preferable? I believe the output mode is preferable because it offers the low impedance of the output driver out at the unconnected pin. When an input mode is used the internal pullup resistors are usually very large values (40K to 150K range is typical) and as such the input impedance is correspondingly high at the unconnected pin which leaves the possibility of that external signal coupling could possibly happen and make the pin appear to toggle or enter the invalid space between the guaranteed high and low logic level thresholds.

Alternative consideration. If you ever want to plan a board design in a way that in the future you may want to use a pin for some work around or to add a new feature using the pin as input but connecting as external pullup resistor is a good strategy. First off you can select a lower resistor value such as 4.7K or 10K to keep impedances down. Secondly the resistor pad offers a very good place to solder re-work wires when you want to prototype that new feature on an existing assembly. This technique is especially valuable when the most modern types of MCU packages are in use with high density SMT pads that are next to impossible to solder a re-work wire to them.