High-energy reconstruction for single and double cascades using the KM3NeT detector