Thanks in advance.
If you have the right to sell it than yes
Ask the original author for the license. Even if you change 95% of the code 5% is from another person and you can’t sell it without permission
The answer to your question is, if the use is transformative than it’s fair use, if not get permission (a license). The percentage used (no more than necessary) is a factor in determining fair use.