“At the end” is used more in daily conversation, like “at the end of the day, or at the end of the ride.” It suggests an arrival.
“In the end” is used more when describing the end of a story or hypothetical situation. “In the end, Matthew won the war, or, in the end, they lived.”
A trick to remember:
At- arrival (or describing literal time)
In- inside (inside a scene, object, or hypothetical situation)