Is it possible to reduce a sketch size be modifying libraries?

Yes, you can shrink libraries, by removing from the .cpp file all those functions that are never called and are never called elsewhere in the library either. The linker won't remove those functions, all it will remove is any entire .cpp files in the library that don't contain any code or data that is needed. So if the library has only a single .cpp file, then you get all of it or none of it.

Once you've removed any functions you don't need, you can remove any data declarations that were used only by those functions.

There are a couple of exceptions:

  1. Templates functions and classes. For these, the compiler only instantiates what is needed; so there is nothing to be gained by removing them.

  2. Functions in derived classes that override virtual functions with the same name and parameters in an ancestor class. In this case, if objects of the derived class are created, then the overriding function can get called even if you think you are calling the version in the base class. The classic case if the write() function in classes such as HardwareSerial that derive from class Print.

Having said that, if you are 5K over the size limit, then it's probably simpler to upgrade to a Mega.