Dominated compactness theorem in Banach function spaces and its applications