A source file that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and, therefore, to maintain.
Above a specific threshold, refactor the file into smaller files whose code focuses on well-defined tasks. Those smaller files will be easier to understand and easier to test.