Three roles, three sets
Training data fits the model. Validation data tunes hyperparameters and picks between models. Test data answers one question: did the choice you made on validation generalize? If you ever look at the test score before the final model is frozen, you have just turned the test set into another validation set and lost the only honest estimate you had.
Stratify, group, time-respect
For classification with class imbalance, stratify the split by the label. For grouped data (multiple rows per user), split by user. For time-series, split by time and never let future rows enter training. Mixing strategies is how leaderboards get gamed and production systems get embarrassed.
The frozen test set ritual
Pickle the indices of the test set on day one and never recompute them. If the data changes, build a new dataset, do not slide the test set. The frozen-test-set ritual is the difference between a calibrated team and a team that lies to itself.