Handing toddler running off

Is it ok for someone, like a relative, to grab your toddlers arm (gently of course) to stop them from running out to another person’s yard or heading towards a road (or anything like that, where they’re not in immediate danger but you don’t want them heading for it) Would you rather them stop your toddler another way?

Toddler also doesn’t understand “no” yet