In texas holdem, the best five-card combination wins. With flushes, the highest five card group of flushed cards wins. If the board is a flush, it just comes down to who has the highest flush card in their pocket. That's assuming that the highest flush card out there is higher than the lowest flush card on the board.
So if the board is:
Player 1Player 2
Player 2 would win with a flush AKQT7 all of hearts over Player 1 with a flush of AKQT6 of hearts. Note that it does not matter that Player 1 had a sixth flush card, the Five of Hearts. Since holdem uses only the best five card combination, that sixth card is never considered.
However, if the board was instead:
Despite each player having a heart or two in their hand, the best possible hand they can make is a flush using only the cards on the board. So it would be a split pot.