It is always better to apply the finance first. Real estate agents have more confidence in a finance buyer who approaches them for a property with a pre approval already in hand.
Once you know you’re budget you can obtain a pre approval based on your maximum. This allows you to navigate and browse the property market with the confidence that a bank has already declared what they are able to lend to you.