You’d send an inspector most likely after you have it under contract. You can probably send a contractor before or after it’s under contract.
Buying out of state is one thing, managing a rehab from a Far is much more difficult. Just something to consider
You need to get the property inspector booked right after you and the Seller sign the Sales Agreement because you only have a certain amount of time to conduct all of your due diligence. You also need to have exit contingencies in your Sales Agreement in the event that something comes up and you want to back out of the deal.
In answer to what makes the most sense in regards to a contractor or inspector, both would be ideal but if you can't, an inspector is fine. If you take the time to research and get a good inspector, a lot of your questions regarding assessment and rehab costs would actually be answered by that individual. Make sure they have experience in the types of properties you are looking to buy and being licensed is a plus.