They also have short-term protection up till the testimony is complete, where they stick the witness in a hotel somewhere under guard, etc.
I think it’s common procedure for the prosecution to request the judge protect the witness by not informing the defense of the witness’ exact identity before the trial.
The risk tends to depend on the accused. If they’re not part of a dangerous group, the accused being in prison until the trial may tend to prevent their interference. Also for most people, the potential legal consequences of messing with jurors would tend to be a deterrent. Against organized crime or the super-rich, there are multiple possible agents who might try something, but testimony is deposed before the trial, and if it changes materially for the trial, or something happens to a witness, that can backfire for the accused, and expose them and/or others to new charges.
These and other points are covered in such places as:
https://www.cps.gov.uk/legal-guidance/witness-protection-and-anonymity
https://www.unodc.org/documents/middleeastandnorthafrica/organised-crime/Good_Practices_for_the_Protection_of_Witnesses_in_Criminal_Proceedings_Involving_Organized_Crime.pdf
https://pceinc.org/wp-content/uploads/2016/07/20160610-Witness-Intimidation-What-You-Can-Do-To-Protect-Your-Witnesses-PCE.pdf