Both verbs tener and haber both are translated as to have.
What are the rules that distinguish the use of one verb over the other?
Haber meaning to be in possession of is not really used anymore. However, haber meaning to be obliged to is equivalent to tener:
Juan tiene que ir al médico.
Juan ha de ir al médico.
Although I would say that the second sentence is more formal.
Other than that, haber is mainly used to conjugate other verbs, or meaning to exist as explained in this article by the RAE.
You can translate "tener" as to have but I think translating "haber" the same way is far from being the best option. "Haber" has quite a few usages and "to have" is the least common (the RAE list it as obsolete http://buscon.rae.es/drae/srv/search?id=5ra5cGATFDXX2hZam4lB)
The main uses of "haber" are as an auxiliary verb for compound verbal constructions and the other is to indicate existence in impersonal sentences (without subject).
To have something. To possess something, a feeling, etc.
Tengo dos gatos
Tengo tres dólares en mi mano
Tenemos miedo de tí
Él tiene frío
To have existence.
To have had done something.
Hay dos camas en el cuarto
Ya lo he visto
Hay que hacer ejercicios.
It is mainly used in its auxiliary form to create a "perfect" tense.
Ya comí / I already ate
Ya he comido / I have already eaten
"Haber" and "tener" have very different meanings and can almost never be used interchangeably. Haber can mean there is/are or can be used to form the perfect tense.
e.g: Hay muchas personas aquí = There are many people here. (haber in the sense of 'there is'. Ya has comido? = have you eaten? (haber in the perfect tense)
Tener generally means to have but can also be often translated as 'to be' in certain expressions.
e.g:tengo dos perros=I have two dogs. tienes un cigarrillo?=Do you have a cigarette?
tengo hambre=I am hungry. Él tiene seis años=He is six years old
In short, if you are wanting to say 'to have' in the traditional sense of the verb, use 'tener'. If you want to say 'to have' to express the perfect tense, use 'haber'.
This blog post goes into more detail: Haber vs tener: https://www.clozemaster.com/blog/spanish-haber-vs-tener/
Clozemaster is a language learning game. Its blog has a lot of useful posts on Spanish grammar. Hope this could be of help.