Anything you do makes you subject to arrest (and even if you do nothing sometimes) but pulling a gun out especially.
Problem with some circumstances is that one does not know all the facts. Is the person holding a gun a person who was attacked and just disarmed the other? Is the person a cop?
If you are witnessing a crime in action, I see nothing wrong with unholstering the weapon - a criminal is nearby.
Now can you shoot a purse-snatcher? In most states that I have looked at, no. Can you shoot a person you saw just kill someone if running away? In my state, yes. In other locations? I dunno.
To answer your question requires a complete examination of every 50 state's gun laws, citizen arrest laws, and other laws.
Limit it to one state and people might be able to give some advice that is reliable and can be based on case law.
But YOU should do some legal R&D and post your results prior to posting and note the results - you are asking for people to do your legal research for you..you should at least try to figure it out for yourself first. This is not a simple "can I carry into a liquor store" type of question.