The IceCube Neutrino Observatory at the South Pole realizes a vision of employing neutrinos as unique messengers to investigate the high-energy universe. The detector instruments one cubic kilometer of glacial ice with more than 5,000 digital optical modules, designed to record Cherenkov light emitted from high energy particles interacting in ice. This provides sensitivity to neutrinos with energies from a few hundred GeV to beyond the PeV scale. These measured neutrinos are both atmospheric and astrophysical in nature. IceCube also detects muons produced from cosmic-ray interactions in the atmosphere. Data collected with IceCube enable us to probe a wide range of physics processes, from particle-physics phenomena to the astrophysics of cosmic sources. In this talk, I will present the latest IceCube measurements of diffuse astrophysical neutrinos, focusing on their energy spectrum and flavor composition. I will also discuss searches for the astrophysical sources of these neutrinos, in particular, studies of associations between neutrinos and gravitational-wave events.