Either, depending on the circumstances. If there are plenty of defenders around and it is a mis-timed challenge, nothing malicious, it may not even require a yellow card - just a penalty.
If it was with malicious intent anywhere, or if the defender was the last man, then it deserves a red card.
Not all fouls wherever on the pitch deserve a booking it depends as JJ109 says on the circumstances. Red cards are for reckless tackles, preventing a goal scoring opportunity or 2 yellow cards as per the rules.
So the answer does depend on the interpretation of the offence by the referee.