While in the bathroom, I noticed a white liquid, similar to sperm in smell and appearance, that came out during defecation. Might this have been caused by straining? In such cases, is it necessary to perform Ghusl?
Bismihi ta'āla
No. You do not need to do ghusl. The only time you will need to do ghusl is when the seminal discharge is by ejaculation, or intercourse. The pre-seminal fluid, etc, do not need ghusl. In your case, as it came out with urine, it just needs washing.
And Allah knows best