During lockdown I found some books/articles online for my thesis. Am I allowed to quote them or is it unprofessional? Should I find a paper edition and quote that instead?
You want to reference reliable material - whether physical or virtual. If you read an article online in a refereed journal, or quote a standard book in your field that you read electronically, credit both the physical reference and the url in your bibliography.
References to, say, wikipedia or blog posts or unrefereed work you stumble across on someone's website may be problematic. To use them you have to make a case that they are correct and reliable.
Short answer: Yes.
Longer answer: When the book is a reputable source and you are sure the electronic version has the same content, you can cite it just as the paper book. Nobody cares about if you read it on dead trees or as PDF and people will not even know it.
The versions you found online may or may not be legal to download, but this has nothing to do with being allowed to cite them. Just make sure you find the right citation format, such that one can find the book.
If the book has a online version (and your copy may or may not be a pirated version of the online version), have a look if the online version needs to be cited in a different way (e.g. having a different publisher or a different number of pages).
You'll usually find the right citation format with Google Scholar, both for paper books and online versions.