I'm worried that if I get denied the UK visa my passport could be stamped and which is a big risk in case of any other time and any other country embassy like the USA or Canada.
From the range of questions we keep on seeing here related to UK visa refusals, i can safely say that nobody mentions receiving a rejection stamp on their passport.
However, it does not matter. Stamp or no stamp, you still have to declare your previous refusals on the US and Canadian visa applications if asked.
which is a big risk
Visa refusal will be recorded in the database regardless and if you don't declare it you risk a ban under deception. A refusal is a very small risk compared to that.