A surgical mask is only to keep the wearer from introducing spit, saliva or phlem onto someone else. Really doesnt filter anything, except errant blood drops or spray for a surgeon.
An N-95 mask with a tight facial seal will filter in both directions. An N-95 mask withe an exhaust valve will filter on inhaling but will not filter on exhale and can release particles onto others, but they are far more confortable to wear. Less heat and moisture build up.