@Viridis1886 is spot on.
Holding offences that start outside the PA and continue into the penalty area are penalty kicks.
Any other foul: trip, push, kick, strike etc are at the point of contact.
If there are multiple attempts to foul, for example 2 attempts to trip, one outside the PA and one inside, then you can (effectively) play advantage and award a penalty kick for the 2nd offence, but this is 2 offences rather than a continuation of 1 offence as with holding.
I have a question. Should the foul on messi at 6:28 of this video be a free kick or penalty ? For me it's to difficult to call. Here's the link of the video: