To utilize the free space you first need to shrink the filesystem. Even though it's only using a subset of the space available, data could be scattered anywhere within the partition. Shrinking the filesystems compacts it.
Next, you'll need to shrink the partition containing the filesystem while making sure you don't shrink it too far.
parted has support for shrinking (some) filesystems. So as long as the filesystem in question is one of those supported, you can use
parted to shrink the filesystem and the partition in one go.