It sounds like a communal garden "flakey connection" .. the soluions are:
a) Run an Ethernet cable
b) Use an external WiFi device with a better antenna
c) Use an Ethernet bridge (combines both)
d) Run and Ethernet cable <= always the best
RPi4 has better wireless than previous Pi devices that I've used, but it's not the best WiFi device.