The starting point is to find the plat of your property and talk with the zoning department to determine your setbacks. That will give you the allowable building envelope. Do not use information from friends or a cousin or a know it all across the street. You want reliable information to determine where your allowable building envelope is.
Even if you build a detached garage, sometimes the zoning or covenants will require it to look similar to your house or it can only be so big.
Do your homework before you go down a path too far
then plan on $300 a square foot. If you aren’t scared away yet, now you have a budget and you will be within it. Yes, I know $300 a square foot is high, but it is easier to add things into a big budget than to add things into a blown budget.