Generally no. I usually find that giving someone unsolicited advice comes across as condescending more than it comes across as helpful. I’ve only really done it once and it was when a kid was trying to bench way more than he could handle and didn’t have his hands evenly distributed on the barbell so it was leaning to one side. That was less of a “let me help you” and more of a “I don’t want to see this kid kill himself in front of me”
Depends on if the person looks friendly or if they’re really gonna injure themselves. The only time I really had the courage was when a guy (who looked new at my gym as I had never seen him before) was locking his knees real bad on the leg press and I went up to him in between his sets and politely let him know