I haven't had this experience, but anyone I know who did their doctors recommended supplementing with formula. If you are breastfeeding, ensure the latch is correct so baby doesn't get tired out before getting hindmilk. A lactation consultant helps with this, but there are so many lactation consultants online who offer help.
Are you breastfeeding and supplementing or just giving formula? If breast milk is involved I suggest you up your proteins and healthy fats...plant based is best from what I've read (I know it's controversial so just do whatever suits you!) ...things like Chia hemp seeds flaxseeds all kinds of nuts cooking w avocado oil eating avocado drinking water too can really help the quality of the milk. If you're doing formula, it's worthwhile to check an alternative ... Is babe eating on demand? And at least every 2 hours? I would really advocate for more testing w the doc too to see if you can find out the source of the issue... Don't give up mama! Keep at it and baby will be ok! I had a friend who's baby was 1% percentile he grew and still stayed small yet perfect! He was just meant to be small as they found out :)