In attempt to play the ball, the goalkeeper trips the attacking player who has been about to face an empty goal in case of no offence. He should be therefore deemed to have denied an obvious goal-scoring opportunity. A yellow card has to be issued (reason: attempt to play the ball).
The defending player carelessly trips his opponent who is facing the goalkeeper in a 1v1-situation with no other defender being able to intervene. He therefore clearly denies an obvious goal-scoring opportunity.
If the referee has the opinion that in this concrete situation there was no real possibility to play the ball and as the defender did not clearly attempt to play the ball via his defending action either, a red card should be issued in line with the revised Law 12. If the referee however deems the action of the defender as attempt to play / get the ball, then he should only caution him.
The IFAB's new Law 12 wording and guidelines are not clear enough to make a final judgment on this situation. We recommend a red card here as the defending action was not totally aimed at getting or playing the ball but accept that interpretations can be divergent here.
In attempt to play the ball, the defender comes a short but important moment too late and unfairly denies an obvious goal-scoring opportunity. He should receive a yellow card.
Referees are reminded to integrate the possibility to play the ball and specially the following consideration into their judgment:
Did the offending defender focus on the ball or on his opponent when making his challenge?
a) Focus on the ball: Yellow Card.
b) Focus on the opponent: Red Card.
This clip also shows that from different angles the question above might lead to different answers and implications. From the side (live cam), you can see that the defender is only very shortly coming too late but initially attempted to play the ball. From behind, it looks as if he is mainly interested in stopping the opponent.
Of course the categories "Focus on ball" and "Focus on opponent" are not clearly black-or-white so that answering this question in a dynamic match situation will be up to the match officials' discretion and assessment. If you have doubts, better choose the Yellow Card. Only CLEAR cases of focussing on the opponent instead of the ball should result in Red Cards.