Hey there, pipigo168!
Thanks so much for using Apple Support Communities.
We know how important it is that you're able to charge your iPhone reliably and we want to help you get this sorted out. Since you mentioned that you're using a third-party adapter, we do want to stress the importance of using genuine parts for your iPhone; including the power adapter. These parts go through specific testing for safety and compatibility with your device and we do recommend using them whenever possible. Since this issue is occurring with a third-party adapter, we would recommend using a genuine adapter and seeing if the issue continues to occur.
You can learn more about Apple power adapters right here: About Apple USB power adapters. This article also includes guidance on how you can make sure the part you're buying is certified and genuine.
We also wanted to include links to two of the power adapters we'd recommend for use with your iPhone models:
20W USB-C Power Adapter12W USB Power Adapter
We hope this does the trick for you!
Cheers.