There certainly is a protocol to avoid contaminating other worlds which might host life, and it is broadly described by the phrase “planetary protection.” Planetary protection boils down to not sending any spacecraft to places which might host life without pushing the spacecraft through our absolute best, most ridiculous sterilization process, to avoid even potentially contaminating that world with Earth microbes. It also means protecting our own planet from any microbes which might live over there, and carelessly letting them roam free on our home.
Any country which has signed on to the Outer Space Treaty, overseen by the United Nations (which is most of them at this point) is legally bound to try their best to avoid contaminating any world. Generally, we want to avoid bringing too many Earth contaminants along in any case, because it will muddle our measurements of the other world. The last thing you want to do when taking a very precise measurement of a moon of Jupiter is to accidentally also measure Leftover Earth Bits.
The current guardian of the planetary protection guidelines is a committee named COSPAR (Committee on Space Research), and they’ve got five tiers of “how much does your spacecraft need to be super sterile.” The first is for objects like the Sun or Mercury, where there’s no hope of life on that world. The second is for objects like the Moon or Venus, where there’s interesting chemistry but it’s pretty unlikely that you’re going to contaminate any life there. The third is for flyby missions, where you’re going past a world which could have life, like Europa or Mars.
The fourth category is also for worlds which might have life (in our solar system, this usually includes all worlds with water by default) but is for landers and rovers, where you’re getting much closer to the place that life might be. A flyby mission, in principle, should not get that close to the planet -- but a rover is going to be right there in the dust. All of our Mars rovers are in this category, and have to undergo really strenuous sterilization. If your rover is not searching for life, and is not in an area that might have any (a really dry part of Mars, for instance), you can get away with only having 300 bacteria per square meter of your spacecraft’s surface. (This is still very, very clean.)
If, on the other hand, you’d like to look for life, or would like to go near where there appears to be liquid, your spacecraft has to be 10,000 times cleaner. The only way to do this is to bake your spacecraft in a dry heat oven, which was done for the Viking landers, whose purpose was to search for life on Mars.
For stuff coming back from other worlds, there’s a similar “is there life?” divide for what needs to be done with the material. For something coming back from an asteroid (like the Osiris Rex mission, and Hayabusa 2) where we really don’t expect there to be any life, you just want to not contaminate your precious sample -- it’s a standard level of scientific caution, like with not wanting to measure the Earth when you’re intending to measure Io.
But if we’re not sure if there should be life, or we’re suspicious that there might possibly be life in our little sample, and we want to bring it back to Earth, you have a whole lot of quarantining to do before you even get back. First you have to make sure that your spacecraft is clean enough to safely go there and not contaminate, say, Enceladus. Then we have to make sure that Enceladus doesn’t contaminate us, and the suggested path there is to take your entire spacecraft, and put it inside a box, and then send that box back to Earth. Since the box didn't go to Enceladus, it should be safe to land the box on Earth, and then you can take the box to the cleanest clean room of all time to crack it open and retrieve your sample. Hopefully, with those precautions in place, both the Earth and Enceladus are uncontaminated, and scientists will be very happy.