Day 6 turned out to be the easiest day in the range so far. A simple implementation of the algorithm was more than sufficient.
I later learned that it was a quadratic function. On the subreddit Deatranger999 said:
If you hold down the button for x seconds, then you will beat the distance if the quadratic x^2 - t x + d is at most 0, where t is the total time of the race and d is the distance you’d like to beat. So I just plugged each one into WolframAlpha, found the roots, and then calculated the number of integers between the two roots.