Yeah, it completely depends.
The most obvious loss is when you're castled behind that bishop. So that color complex around your king is weak.
As an easy example, if your opponent has a bishop that can jump on that long diagonal, that may be fatal for you... or it may not matter. But honestly the first thought I have is to check if my opponent still has that color bishop. If he does, it's not an automatic refusal to win the pawn, but it's time to use caution.
Also consider the pawn you win. If it's the knight pawn across the board, sometimes it's not worth much. It may even help your opponent to have an extra open file for their rooks!
At the other extreme, the pawn is very important, and their position collapses
So yeah, it's hard to say for sure. You have to judge each position.
Do you sacrafice the fianchetto bishop to win a pawn? Or is the question to broad to answer, Any insight/Ideas would be great thankx.