While button is held, output another pin as high- up to a maximum time length

I'm expecting to need a sub-loop within the main loop, which will run when the proxpin is HIGH.

No, you do not want this.

Simply record the time when proxpin goes HIGH, and in the main loop, time other actions on that basis.