Don't mix two problems and think they are one

Once you get into coding several thousands lines of code, you might use the tabs functionality of the Arduino IDE.

I use to use many of them:

a) declarations, includes, functions, options
b) setup
c) menu
d) data processing
e) display (if exists)
f) serial reporting/debug
g) action/output/end loop

h) read-me (only comments, will later be placed at the beginning)
i) parked (commented out code)
j) library functions to which i am not yet familar (comments)

The tabs have the advantage that you can switch quickly between the blocks of code (the cursor remains for each tab where it was last)

The parked section enables me to roll back easily if some new code was rubbish
The library functions enables me to write new functions the right way until i have them permanently on mind.