If you perform the encoding before the split, it will lead to data leakage (train-test contamination) In the sense, you will introduce new data (integers of Label Encoders) and use it for your models thus it will affect the end predictions results (good validation scores but poor in deployment).
Suppose test data has new class which was not available in train data but you do label encoding it will be available in the model which leads to data leakage
After the train and validation data category already matched up, you can perform fit_transform on the train data, then only transform for the validation data - based on the encoding maps from train data.
Almost all feature engineering like standarisation, Normalisation etc should be done after train testsplit. Hope it helps