If the pans are not the correct size, the cake will not bake correctly. If the pan is too small the batter will be too deep and it will not cook fully. If the pan is too large the batter will be too shallow and may burn.
Baking pans need to be in correct size because when we bake the cake it airates and fluffs upwards, if it is flat it falls flats doesn't able cook inside.