Wash your hands thoroughly after applying gels and allow the skin site to dry completely before dressing. You may choose to apply the gel to a site where you do not expect much skin to skin contact. You may consider using gloves to apply the gel, this will prevent any transference from your hands. You may also consider changing the timing of your application.
If for any reason another individual comes into contact with the gel area before it has dried, ask them to wash their hands or the area of skin affected thoroughly. A brief, one-time contact should not pose a risk.
Alternative hormone preparations are also available if necessary. For oestrogen, you could switch to patches or tablets. For testosterone, you could switch to injections.