united-states
See Coolidge v. New Hampshire, 403 U.S. 443:
Where the initial intrusion that brings the police within plain view of such an article is supported not by a warrant, but by one of the recognized exceptions to the warrant requirement, the seizure is also legitimate. Thus, the police may inadvertently come across evidence while in "hot pursuit" of a fleeing suspect.
canada
See R. v. Gill, 2019 BCCA 260, where the Court quoted with approval from Coolidge (para. 26) and the following passage from James A. Fontana & David Keeshan, The Law of Search and Seizure in Canada (para. 40):
When an officer finds such evidence — contraband, stolen property or crime evidence — unexpectedly in the course of his duties, in circumstances where it is at once obvious and visible without positive action on the officer’s part to make it observable, he has the right to seize it. It may arise in circumstances in which the officer is already lawfully in the premises (under valid warrant, hot pursuit of a fugitive, emergency, etc.) and in the course of these duties he comes across seizable items in plain view, or, it may arise in circumstances where there has been no entry onto premises, but the seizable items present themselves to his view (e.g., in the rear of a pick‑up truck parked on a public street).