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

Go through your logic very carefully.

As the code currently stands, you read out the time only when (digitalRead(ProxPin) == HIGH).

If you want all decisions to be based on the most current time, read it just after the start of the loop function.

Usually, people reset startMillis periodically. Otherwise this is a one shot program. In your case, it might make sense to reset startMillis either when the button is released, or pressed, depending on what you want to accomplish. Study the "blink without delay" program example to see what I mean.