Feeling Feelings vs. Changing Thoughts

If I am experiencing a negative emotion, how do I determine whether it’s best to sit in the feeling for a while, or try to change the feeling right away by changing my thoughts? For example, if I’m feeling overwhelmed because I think a task is going to be difficult, should I allow myself to feel overwhelmed for a while, or can I try to change the thought immediately? If you would recommend remaining in the feeling, at what point should I try to change the thought? Thanks!