Temazepam will work mainly cause it's really heavy and relaxes the shit out of you including physically. If it's mainly the panic / anxiety, just use a benzo with good anxiolytic potential like Ativan or Xanax.
Don't take a whole lot of the benzo, and definitely don't take the Ambien. I've blacked out on LSD and Xanax alone and had a really crazy 3 days.
For that reason I personally would avoid the benzos that have significant hypnotic (sleep aid) and amnestic (memory impairment >> blackout) action, even if like temazepam they have appeal being strong.
While I blacked out on LSD and xanax one time, and xanax does have amnestic action - I wouldn't recommend against that one. I took too much too fast, that is the main thing not to do with any benzo! In most cases you will just relax if you take one, then another... and blacking out is not always a huge acute chance... but what you aim for is to take the edge off enough to be relieved of terrible nervewrecking panic. That should be quelled relatively easily - don't take more of the benzo than you absolutely feel like you have to.
Also try to find other ways to deal with a really difficult trip than using a benzo. While sometimes being the lesser of two evils, usually a benzo is not great either in a bad trip. Because it just kind of pauses everything nothing is solved. It's like bailing in the middle of a difficult therapy session with your psychiatrist. Sometimes you are better off facing your demons (unless you are quite unstable in which case you have no business tripping in the first place).
At other times the torment doesn't seem to have any point or content and is more like overstimulation. That is NOT like difficult therapy, that's just agony.