I kind of have an idea when 了 and 过 should be used but it's mostly on a case by case basis, and I don't know the exact rules.
So if I want to express something that happened in the past, when should I use 了 and when should I use 过?
There are multiple uses for both 了 and 过, so it's good you are just asking about usage to express past action or events. 了, as you probably know, is often used to express a change of state. Perhaps somewhat relatedly, 了 can be used to express a past action that is still ongoing. But 过 cannot: when 过 is used to refer to a past event, that past event must have completed. Additionally -- and most distinctly -- 过 is used to express having had the experience of something, rather than a particular instance. As a simple example, consider the difference between
我去了长城 (I went to the Great Wall, refers to a single trip)
我去过长城 (I have been to the Great Wall, could be one or more times)
Here the same structure is used intentionally.
When combining them, it emphasizes the completion of a single action or event. So, for example,
我去过了长城 (I went to the Great Wall, refers to a single, completed, event)
了means completion, like have verbed or have been verbing，过 mean completion before the time the speaker speaks, like verbed in english.