If you’re using mp3 the sound usually won’t loop seamlessly. wav and ogg will loop better, lossless wav is best, but ogg can be ok if start and end are trimmed at zero crossings points.
See this from Audacity: https://manual.audacityteam.org/man/tutorial_looping.html
Step 3: Exporting Loops
The selection may be exported using File > Export > Export Selected Audio….
The lossless PCM WAV format is the best format for loops. Choose “WAV (Microsoft) signed 16-bit PCM” when exporting. Many lossy, size-compressed formats like MP3, WMA and ADPCM WAV suffer from added silence at the the start or end of the file or other issues that do not respect the exact length.
Seamless loops should normally be exported in a lossless format such as WAV. Note that seamless loops should NOT be exported in MP3 format because encoder/decoder overall delay is not defined, which means there is no official provision for gapless playback.
If a compressed file format is required, try OGG Vorbis (though understand that because OGG Vorbis is a lossy format, the encoded audio is not exactly identical to the original audio) . OGG Vorbis loops will generally perform acceptably provided that the start / end of the loop are at zero crossing points.