As a general rule of thumb, best practice to maximize both your cardio and strength training would be to separate cardio and lifting into different days. However, for shorter, low-intensity cardio (10-30 minutes), the timing isn’t as critical. You can do it before lifting as a warm-up, and it won’t significantly impact your strength training session. In fact, many people prefer this approach as it is an effective general warm up to get the heart pumping and get a little sweat going.
If you cannot always separate specific strength and cardio days, aim to separate cardio and lifting by at least 6 hours if possible. This allows your body to recover between activities and maximize the benefits of each. If you are strapped for time or have scheduling issues and need to do both in the same time frame, do your strength training first and your cardio after.
For longer cardio sessions (60+ minutes) or high-intensity interval training (HIIT), it's recommended to do cardio after strength training because this helps avoid an "interference effect". Cardio causes vasodilation of the blood vessels, which is one of the main acute responses that cardio achieves, while strength training triggers vasoconstriction, the temporary restricting of those vessels. If you do your strength training after cardio, you lose all of the cardiovascular benefits that the cardio triggered. However, by doing cardio second, you still get all of the muscular impacts from the strength training and still have the vasodilation occur. Ultimately, by doing it in this format, you are mitigating the interference effect as much as possible.