I found a quote on a website that I want to use, but the website says they got the quote from a book, should I reference the website or the book for this quote?

You should reference the original source, which in this case would be the book. It was not the website’s idea or creation (that quote) so you want to give proper credit to that original author.