When getting close to the goal line in american football a penalty is enforced by half the distance to goal.
From what yards does that start or does that depend on the penalty (5/10/15 yards)?
This penalty situation will vary depending on the penalty, and where the penalty is enforced.
Long and short of it: if the Penalty distance is more than half the distance from the spot the foul is enforced to the offender's goal line, it is "Half distance to the Goal".
So, for example, if there was an Offensive Holding call, and the offence is on their own 19 yard line. Normally this is a 10 yard penalty, but because they are inside the 20 yard line (10 yards > (19 yards / 2)) this would be given as a "half-distance" penalty.
From the 2019 NFL Rulebook Rule 14.2.1:
ARTICLE 1. HALF-DISTANCE PENALTY
If the enforcement of a distance penalty would move the ball more than half the distance from the spot of enforcement to the offender’s goal line, the penalty shall be half the distance from the spot of enforcement to its goal line. This general rule supersedes any other general or specific enforcement of a distance penalty.
This would also be called if there is Defensive Pass Interference inside the end-zone, and the line of scrimmage is inside the 2 yard line.
Penalty: For pass interference by the defense: [...] If the interference is behind the defensive goal line, it is first down for the offensive team on the defense’s one-yard line, or, if the previous spot was inside the two-yard line, halfway between the previous spot and the goal line.