unmittelbar
immediate
Direct, with no temporal or spatial distance; following right away or directly adjacent.
Das Hotel liegt in unmittelbarer Nähe zum Strand.
The hotel is in the immediate vicinity of the beach.

immediate / direct
Loading your saved state.
immediate
Direct, with no temporal or spatial distance; following right away or directly adjacent.
Das Hotel liegt in unmittelbarer Nähe zum Strand.
The hotel is in the immediate vicinity of the beach.

The word is easy to understand if you analyze its parts: 'un-' (not) + 'Mittel' (something in between) + '-bar'. So 'unmittelbar' (immediate/direct) literally means that there is nothing in between—spatially, temporally, or figuratively.
Zwischen den beiden Ereignissen bestand ein unmittelbarer Zusammenhang.
There was a direct connection between the two events.
For spatial closeness, the phrase 'in unmittelbarer Nähe' (in the immediate vicinity) is often used. For temporal closeness, 'unmittelbar' (immediately) is frequently combined with the prepositions 'vor' (before) or 'nach' (after).
Die Apotheke befindet sich in unmittelbarer Nähe des Arztes.
The pharmacy is located in the immediate vicinity of the doctor's office.
In a figurative sense, 'unmittelbar' (direct/immediate) is often combined with nouns that express a direct connection or consequence. Typical phrases are 'unmittelbare Auswirkungen' (direct effects), 'unmittelbare Folgen' (immediate consequences), or 'unmittelbare Gefahr' (immediate danger).
Die Entscheidung hatte unmittelbare Folgen für alle Mitarbeiter.
The decision had immediate consequences for all employees.
'Unmittelbar' (immediately/directly) can also be used as an adverb to intensify a preposition or another adverb. It then means 'direkt' (directly) or 'genau' (exactly).
Unser Ferienhaus liegt unmittelbar am Strand.
Our vacation home is located directly on the beach.
immediate / same
'gleich' and 'unmittelbar' can both express that something is very close, either in time or in space. 'gleich' is very natural in everyday language, especially when something will happen soon: 'Ich komme gleich' (I'll be right there). It can also show spatial closeness, for example 'gleich nebenan' (right next door). 'unmittelbar' sounds more precise and often a little more formal. It emphasizes that there is no distance, no pause, or no intermediate step in between. In normal conversations, people are more likely to say 'gleich'; in reports, instructions, or precise descriptions, 'unmittelbar' often fits better.

Unmittelbar nach dem Termin schreibt er die wichtigsten Punkte auf.
Immediately after the appointment, he writes down the most important points.
Mein Nachbar wohnt gleich neben der Werkstatt.
My neighbor lives right next to the workshop.