Disruption during recording

Recently I did several walks whereby the recording stopped during the walk. When I look at the screen it offers to continue but then parts of my walk are missing. My iPhone has software version 16.4.1. What can I do to avoid this problem?