The pair, who divorced in 1996, both reside at the Royal Lodge on the Windsor estate.
The source told CNN that the Duchess bonded with the monarch over a shared love of dog-walking and horse-riding.
Even after her divorce from Prince Andrew, Sarah continued her friendship with the Queen by walking dogs through the Windsor estate, the source added.
The Queen, who died Thursday at the age of 96, is reported to have had four dogs, two of whom are Pembroke Welsh corgis, Muick and Sandy.
She is also reported to have left behind an older, mixed breed “dorgi” called Candy and a cocker spaniel named Lissy. It is unclear who will be looking after Candy and Lissy.
In pictures: The Queen and her corgis
Corgis have become synonymous with the monarch, who throughout her long life was regularly photographed with a Welsh corgi at her feet.
The Queen was often credited with creating the dorgi breed when her corgi mated with a dachshund owned by her sister, Princess Margaret.
The Queen’s passion for corgis dated back to her childhood, when she fell in love with her father King George VI’s dog, Dookie. In 1944, on her 18th birthday, she was given a Pembroke Welsh corgi puppy named Susan. Such was her attachment to Susan, she reportedly took her on her honeymoon in 1947. Susan died in January 1959.
The monarch went on to own dozens of corgis in her lifetime. One, Willow, famously appeared alongside her in the James Bond sketch that she recorded for the opening ceremony of the 2012 London Olympics.
When Willow was put to sleep at the age of 14, the Queen lost the last descendant of her original corgi, Susan. According to Reader’s Digest, the Queen had a fondness for corgis because of their “energy and untamed spirit.”
Prince Andrew stepped back from public duties in 2019 following a firestorm of criticism over an interview about his association with convicted sex offender Jeffrey Epstein.
Earlier this year, he paid a settlement to sexual abuse accuser Virginia Giuffre, according to her attorney, and a US district judge agreed to dismiss her lawsuit against the Duke of York.
The prince has repeatedly denied wrongdoing. Still, the allegations against Andrew, 62, have dramatically tarnished his public standing.
To get updates on the British Royal Family sent to your inbox, sign up for CNN’s Royal News newsletter.