To demonstrate how unreliable Preview annotations are when one attempts to extract their text, here is a screen shot of the text annotations applied by Preview in a PDF exported from Pages 11.0 on macOS 11.2.3:

and the output of my AppleScript/Objective-C script on this PDF:

and the result from opening a duplicate of this same PDF content, removing the individual highlight annotations, and then replacing them with Acrobat Reader DC highlight annotations, and saving the PDF. Note the consequence of Adobe using a lozenge style highlight and that it "blooms" over the adjacent unselected punctuation character:

and the result of running the script on this PDF content. Note that I am removing leading/trailing punctuation marks.

# pdf_highlights.applescript
# Reference: https://discussions.apple.com/thread/252623954
# extract into an array, the text from individual PDF highlight annotations
# although it is certainly possible to capture entire highlighted text passages,
# this script is constraining the text to one word highlighted text as the
# original goal was to use these highlight annotations as PDF keywords.
# There is presently no attempt to remove duplicates, but that is a simple matter.
# Note that this script remains unreliable with highlight annotations applied by
# Apple's Preview, but quite accurate when those highlights are applied by
# Adobe's Acrobat Reader DC.
# Tested: macOS 11.2.3
# VikingOSX, 2021-04-04, Apple Support Communities, no warranties expressed/implied
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use framework "PDFKit"
use scripting additions
property NSString : a reference to current application's NSString
property NSURL : a reference to current application's NSURL
property NSArray : a reference to current application's NSArray
property NSCharacterSet : a reference to current application's NSCharacterSet
property PDFDocument : a reference to current application's PDFDocument
property PDFPage : a reference to current application's PDFPage
# where we store hightlighted text words
set hkey to NSArray's array()'s mutableCopy()
set uti_pdf to {"com.adobe.pdf"}
set allowed to NSCharacterSet's alphanumericCharacterSet
# exclude any character not in the implied allowed set
set disallowed to allowed's invertedSet()
# only display PDF documents in the file chooser
set thePDF to POSIX path of (choose file of type uti_pdf default location (path to desktop)) as text
set pdfURL to NSURL's fileURLWithPath:thePDF
set pdf to PDFDocument's alloc()'s initWithURL:pdfURL
set pageCnt to pdf's pageCount()
set pdf_page to PDFPage
repeat with apage from 1 to pageCnt
# we subtract 1 because PDF pages are 0-based in PDFKit
set pdf_page to (pdf's pageAtIndex:(apage - 1))
repeat with anno in pdf_page's annotations()
if ((anno's type()) as text) = "Highlight" then
set arect to anno's |bounds|()
set atext to (pdf_page's selectionForRect:arect)'s |string|()
if atext is not missing value then
# because AcroReader highlight annotations may bloom beyond specific text selection
# and make adjacent punctuation an unintended part of the highlight text
set trimmed_text to ((NSString's stringWithString:atext)'s stringByTrimmingCharactersInSet:disallowed)
# exclude multiple word highlight annotations
if (count of (words of (trimmed_text as text))) = 1 then
# add the text word to the array
(hkey's addObject:(trimmed_text as text))
end if
end if
end if
end repeat
end repeat
# create a text string of array entries punctuated by returns for display purposes
set captured_highlights to (hkey's componentsJoinedByString:return) as text
set pdf_name to (NSString's stringWithString:thePDF)'s lastPathComponent() as text
display dialog "PDF file: " & pdf_name & return & captured_highlights with title "Highlighted Words in PDF"
return