You are right. When expressing obligation, they have similar meanings, while "要" is more formal than"得". We normally don't use "得", say, in official documents. Here are some examples:
"中国共产党要始终代表中国最广大人民的根本利益"
"要加强对权力运行的制约和监督,把权力关进制度的笼子里"
If "要" is replaced with"得" in the two sentences above, they will seem informal and inappropriate.
我们得单独谈谈。
As in this sentence, if we replace"得" with "要", it may sound a little bit stiff.
By the way, when we say that someone has to do something for their own good, we tend to use "得" (but not always). For example:
你得按时吃药,才能早日康复。
你得找个伴了。
In the two sentences above, the speakers are providing well-meant, sincere advice to the listeners, and by using"得" they can enhance that feeling of friendliness.